Submission #1157617


Source Code Expand

#include <iostream>
#include <algorithm>
using namespace std;

using ll = long long;

ll t[100010] = {};

int main(void){
    // Here your code !
    
    ll n,c,k,res = 0;
    cin >> n >> c >> k;
    
    ll befor = 0;
    ll man = 0;
    
    for(int i = 0; i < n; i++){
        cin >> t[i];
    }
    
    sort(t,t+n);
    
    befor = t[0] + k;
    man = 1;
    res++;
    
    for(int i = 1; i < n; i++){
        //cout << res << " " << befor << endl;
        if(befor < t[i]){
            res++;
            man = 1;
            befor = t[i] + k;
        }else{
            
            if(man == c){
                res++;
                man = 0;
                befor = t[i] + k;
            }
            
            man++;
        }
        
    }
    
    cout << res << endl;
    
}

Submission Info

Submission Time
Task A - Airport Bus
User nasatame
Language C++14 (GCC 5.4.1)
Score 300
Code Size 846 Byte
Status AC
Exec Time 49 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
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 49 ms 1024 KB
in3.txt AC 47 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 40 ms 896 KB
in8.txt AC 47 ms 1024 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB