#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main(){ ll N,C,K; cin >> N >> C >> K; vector<ll> T(N); for(int i=0; i<N; i++ ) cin >> T[i]; sort(T.begin(),T.end()); int ans = 1; ll start = T[0]; ll cnt = 0; for(int i=0; i<N; i++ ){ if(T[i] > start+K){ ans++; start = T[i]; cnt = 0; goto nextf; }else{ cnt++; } if(cnt == C){ cnt = 0; ans++; start = T[i+1]; } nextf:; } cout << ans << endl; return 0; }
Task問題 | A - Airport Bus |
---|---|
User nameユーザ名 | kosakkun |
Created time投稿日時 | |
Language言語 | C++14 (GCC 5.4.1) |
Status状態 | WA |
Score得点 | 0 |
Source lengthソースコード長 | 695 Byte |
File nameファイル名 | |
Exec time実行時間 | ms |
Memory usageメモリ使用量 | - |
Set name | Score得点 / Max score | Cases |
---|---|---|
Sample | - | sample1.txt,sample2.txt |
All | 0 / 300 | 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 usageメモリ使用量 |
---|---|---|---|
in1.txt | AC | 1 ms | 256 KB |
in2.txt | AC | 49 ms | 1024 KB |
in3.txt | AC | 46 ms | 1024 KB |
in4.txt | WA | ||
in5.txt | AC | 2 ms | 256 KB |
in6.txt | AC | 47 ms | 1024 KB |
in7.txt | WA | ||
in8.txt | AC | 47 ms | 1024 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |