Submission #7559904


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int N,C,K;
    cin >> N >> C >> K;
    int now=0;
    int ans=0;
    int fast=0;
    vector<int> T(N);
    rep(i,N)cin >> T[i];
  	sort(all(T));
    rep(i,N){
        if(i==0){
            fast=T[i];
        }
        else if(T[i]>fast+K){
            fast=T[i];
            now=0;
            ans++;
          	cerr << i;
        }
        else if(now==C){
            fast=T[i];
            now=0;
            ans++;
          	cerr << i;
        }
        now++;
    }
    ans++;
    cout << ans;


}

/*



 */

Submission Info

Submission Time
Task A - Airport Bus
User lucky_space
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1115 Byte
Status
Exec Time 87 ms
Memory 640 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt
All 300 / 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
in1.txt 1 ms 256 KB
in2.txt 50 ms 640 KB
in3.txt 86 ms 640 KB
in4.txt 87 ms 640 KB
in5.txt 2 ms 256 KB
in6.txt 59 ms 640 KB
in7.txt 45 ms 640 KB
in8.txt 51 ms 640 KB
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB