Submission #2178297
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef long long ll; int cmp(const void *a, const void *b) { return *(ll*)a-*(ll*)b; } int main() { ll N,C,K,T[100005]; ll p_num,i,j,bus_num; scanf("%d%d%d",&N,&C,&K); for (i=0;i<N;i++) { cin>>T[i]; } qsort(T,N,sizeof(T[0]),cmp); j=T[0];p_num=0;bus_num=1; for (i=0;i<N;i++) { if (T[i]<=j+K) p_num++; else { bus_num++;j=T[i+1];p_num=1; } if (p_num>=C) { p_num=0; bus_num++; j=T[i+1]; } // cout<<T[i]<<' '<<p_num<<' '<<bus_num<<endl; } cout<<bus_num<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | vjudge2 |
Language | Clojure (1.8.0) |
Score | 0 |
Code Size | 552 Byte |
Status | RE |
Exec Time | 1231 ms |
Memory | 60196 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 | RE | 1130 ms | 59656 KB |
in2.txt | RE | 1131 ms | 54564 KB |
in3.txt | RE | 1111 ms | 53708 KB |
in4.txt | RE | 1116 ms | 54908 KB |
in5.txt | RE | 1165 ms | 55700 KB |
in6.txt | RE | 1096 ms | 59328 KB |
in7.txt | RE | 1231 ms | 55204 KB |
in8.txt | RE | 1140 ms | 52068 KB |
sample1.txt | RE | 1154 ms | 60196 KB |
sample2.txt | RE | 1139 ms | 59500 KB |