Submission #1156750
Source Code Expand
#include <bits/stdc++.h> #include <iomanip> using namespace std; typedef long long LL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef long double LD; typedef pair<LD, LD> PLDLD; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define CLR(a) memset((a), 0 ,sizeof(a)) #define ALL(a) a.begin(),a.end() LL MOD=1000000007; int main() { LL n,c,k; cin>>n>>c>>k; vector<LL> t(n); REP(i,n) cin>>t[i]; sort(ALL(t)); LL ans=0; LL cnt=0,tim=-1; if(c==1) { cout<<n<<endl; return 0; } REP(i,n) { if(cnt==0) { tim=t[i]+k; cnt++; ans++; } else { if(t[i]<=tim) { cnt++; if(cnt>=c) { cnt=0; } } else { cnt=1; tim=t[i]+k; ans++; } } } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | suginamiku |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1128 Byte |
Status | AC |
Exec Time | 47 ms |
Memory | 1024 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 | 46 ms | 1024 KB |
in3.txt | AC | 46 ms | 1024 KB |
in4.txt | AC | 46 ms | 1024 KB |
in5.txt | AC | 2 ms | 256 KB |
in6.txt | AC | 47 ms | 1024 KB |
in7.txt | AC | 41 ms | 896 KB |
in8.txt | AC | 47 ms | 1024 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |