Submission #1369629
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; } people++; if(people==1) start=t[i]; if(people==c) { bus++; people=0; } 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 | 580 Byte |
Status | WA |
Exec Time | 493 ms |
Memory | 49596 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 | 136 ms | 20740 KB |
in2.txt | AC | 493 ms | 46596 KB |
in3.txt | AC | 488 ms | 46056 KB |
in4.txt | WA | 479 ms | 48772 KB |
in5.txt | AC | 144 ms | 25940 KB |
in6.txt | AC | 476 ms | 49596 KB |
in7.txt | WA | 468 ms | 47780 KB |
in8.txt | AC | 467 ms | 48196 KB |
sample1.txt | AC | 98 ms | 20688 KB |
sample2.txt | AC | 93 ms | 21844 KB |