Submission #1156434
Source Code Expand
#include <bits/stdc++.h> #define N 100001 using namespace std; int main(){ int n,C,K; cin>>n>>C>>K; int T[N]; for(int i=0;i<n;i++)cin>>T[i]; sort(T,T+n); if(C==1){cout<<n<<endl;return 0;} int ans=0; int cnt=1; int l = 0; for(int i=1;i<n;i++){ cnt++; if(T[l]+K<T[i])ans++,cnt=1,l=i; if(cnt == C) ans++,cnt=0,l=i+1; } if(cnt)ans++; cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | haji |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 431 Byte |
Status | AC |
Exec Time | 61 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 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 | 1 ms | 256 KB |
in2.txt | AC | 60 ms | 640 KB |
in3.txt | AC | 59 ms | 640 KB |
in4.txt | AC | 60 ms | 640 KB |
in5.txt | AC | 2 ms | 256 KB |
in6.txt | AC | 59 ms | 640 KB |
in7.txt | AC | 52 ms | 640 KB |
in8.txt | AC | 61 ms | 640 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |