Submission #1478465
Source Code Expand
#include<bits/stdc++.h> #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) for(int i = 0; i < (b); i++) #define all(a) (a).begin(), (a).end() #define show(x) cerr << #x << " = " << (x) << endl; using namespace std; int main(){ int n, c, k; cin >> n >> c >> k; list<int> v; rep(i,n){ int x; cin >> x; v.emplace_back(x); } v.sort(); int sum = 0; while(not v.empty()){ int first = v.front() + k; v.pop_front(); rep(i,c - 1){ if(v.empty()) break; if(v.front() <= first) v.pop_front(); } sum++; } cout << sum << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | noy72 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 696 Byte |
Status | AC |
Exec Time | 1717 ms |
Memory | 3328 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 | 1 ms | 256 KB |
in2.txt | AC | 62 ms | 3328 KB |
in3.txt | AC | 73 ms | 3328 KB |
in4.txt | AC | 61 ms | 3328 KB |
in5.txt | AC | 2 ms | 256 KB |
in6.txt | AC | 1717 ms | 3328 KB |
in7.txt | AC | 54 ms | 2944 KB |
in8.txt | AC | 69 ms | 3328 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |