Submission #1156786
Source Code Expand
#include <iostream> #include <vector> #include <string> #include <cstring> #include <algorithm> #include <map> #define REP(i, n) for(int i = 0; i < n; ++i) #define RANGE(i, x, n) for(int i = x; i < n; ++i) using namespace std; int main() { int N, C, K; cin >> N >> C >> K; vector<double> T(N, 0); vector<int> P(N, 0); REP(i, N) { cin >> T[i]; } sort(T.begin(), T.end()); int ans = 0, curp = 0; int bef = T[0] + K; REP(i, N) { if(T[i] <= bef) { ++curp; if(curp == C) { ++ans; curp = 0; if(i < N - 1) { bef = T[i + 1] + K; } } }else { ++ans; curp = 0; bef = T[i] + K; --i; } } if(curp != 0) { ++ans; } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | lastpoet |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 932 Byte |
Status | AC |
Exec Time | 72 ms |
Memory | 1408 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 10 ms | 764 KB |
in2.txt | AC | 72 ms | 1408 KB |
in3.txt | AC | 71 ms | 1408 KB |
in4.txt | AC | 70 ms | 1408 KB |
in5.txt | AC | 2 ms | 256 KB |
in6.txt | AC | 70 ms | 1408 KB |
in7.txt | AC | 62 ms | 1280 KB |
in8.txt | AC | 71 ms | 1408 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |