Submission #1369633
Source Code Expand
import java.util.*; class Main { public static void main(String args[]) { int n,c,k; Scanner sc=new Scanner(System.in); n=sc.nextInt(); c=sc.nextInt(); k=sc.nextInt(); int[] t=new int[n]; for(int i=0;i<n;i++) t[i]=sc.nextInt(); Arrays.sort(t); int i=0,start,bus=1,people=0; start=t[0]; while(i<n) { if(t[i]-start>k) { bus++; people=0; start=t[i]; } people++; if(people==c) { bus++; people=0; if(i+1<n) start=t[i+1]; } i++; } System.out.print(bus); } }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | jeelvashnav1999 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 682 Byte |
Status | WA |
Exec Time | 527 ms |
Memory | 50060 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt |
All | sample1.txt, sample2.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 129 ms | 22868 KB |
in2.txt | AC | 481 ms | 50060 KB |
in3.txt | AC | 496 ms | 46696 KB |
in4.txt | WA | 482 ms | 47468 KB |
in5.txt | AC | 139 ms | 22368 KB |
in6.txt | AC | 527 ms | 48256 KB |
in7.txt | AC | 458 ms | 47872 KB |
in8.txt | AC | 455 ms | 46568 KB |
sample1.txt | AC | 93 ms | 19668 KB |
sample2.txt | AC | 93 ms | 21076 KB |