Submission #1369635
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 | 683 Byte |
Status | WA |
Exec Time | 494 ms |
Memory | 51036 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 | 128 ms | 21716 KB |
in2.txt | AC | 470 ms | 49172 KB |
in3.txt | WA | 494 ms | 45940 KB |
in4.txt | WA | 485 ms | 49860 KB |
in5.txt | AC | 139 ms | 24548 KB |
in6.txt | AC | 475 ms | 51036 KB |
in7.txt | AC | 482 ms | 47884 KB |
in8.txt | AC | 487 ms | 45636 KB |
sample1.txt | AC | 92 ms | 21716 KB |
sample2.txt | AC | 90 ms | 21844 KB |