AtCoder Grand Contest 011

Submission #1157617

Source codeソースコード

#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

Task問題 A - Airport Bus
User nameユーザ名 nasatame
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 300
Source lengthソースコード長 846 Byte
File nameファイル名
Exec time実行時間 49 ms
Memory usageメモリ使用量 1024 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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