Submission #1533470
Source Code Expand
# include <iostream> # include <algorithm> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <utility> # include <stack> # include <queue> # include <list> # include <unordered_map> constexpr int MOD = 1000000000 + 7; constexpr int INF = 2000000000; using namespace std; using LL = long long; int main() { int n, c, k; cin >> n >> c >> k; vector<int> T; int t; for (int i = 0; i < n; i++) { cin >> t; T.emplace_back(t); } sort(T.begin(), T.end()); int ans = 0; int count = 0; int firstpeople = 0; if (c == 1) { cout << n << endl; } for (int i = 0; i < n; i++) { if (count == 0) { ans++; count++; firstpeople = T[i]; } if (T[i] <= firstpeople + k&&count < c) { count++; } else { ans++; count = 1; firstpeople = T[i]; } } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | M3_cp |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 941 Byte |
Status | WA |
Exec Time | 47 ms |
Memory | 892 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 1 ms | 256 KB |
in2.txt | AC | 47 ms | 892 KB |
in3.txt | AC | 47 ms | 892 KB |
in4.txt | WA | 47 ms | 892 KB |
in5.txt | AC | 2 ms | 256 KB |
in6.txt | AC | 47 ms | 892 KB |
in7.txt | AC | 41 ms | 892 KB |
in8.txt | AC | 47 ms | 892 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |