Submission #7560057


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define uni(q) unique(all(q)),q.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll n,c,k; cin >> n >> c >> k;
    vl t(n);
    rep(i,n) cin >> t[i];
    sort(all(t));
    ll ans = 1;
    ll cnt = 1;
    ll mn = t[0];
    REP(i,1,n){
        if(cnt == c){
            cnt = 0;
            ans++;
            mn = t[i];
        }
        else if(t[i] - mn > c){
            cnt = 0;
            ans++;
            mn = t[i];
        }
        else cnt++;
    }
    cout << ans << endl;
}

Submission Info

Submission Time
Task A - Airport Bus
User suta
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1067 Byte
Status
Exec Time 47 ms
Memory 1024 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 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
in1.txt 1 ms 256 KB
in2.txt 47 ms 1024 KB
in3.txt 47 ms 1024 KB
in4.txt 47 ms 1024 KB
in5.txt 2 ms 256 KB
in6.txt 47 ms 1024 KB
in7.txt 41 ms 896 KB
in8.txt 47 ms 1024 KB
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB