Submission #1156233
Source Code Expand
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fst first #define snd second #define forn(i, n) for (int i = 0; i < int(n); ++i) typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<char> vc; typedef pair<int, int> pii; typedef vector<pii> vii; #define sz(c) (int)(c).size() #define all(c) (c).begin(), (c).end() void solve (int n) { int c, k; cin >> c >> k; vi t(n); forn (i, n) cin >> t[i]; sort(all(t)); int ans = 0; for (int i = 0; i < n; ) { ans++; int j = i; int curc = c; while (j < n && curc > 0 && t[j] <= t[i] + k) j++, curc--; i = j; } cout << ans << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; while (cin >> n) solve(n); }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | Kaban5 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 973 Byte |
Status | AC |
Exec Time | 19 ms |
Memory | 640 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 | 17 ms | 640 KB |
in3.txt | AC | 17 ms | 640 KB |
in4.txt | AC | 18 ms | 640 KB |
in5.txt | AC | 1 ms | 256 KB |
in6.txt | AC | 19 ms | 640 KB |
in7.txt | AC | 15 ms | 640 KB |
in8.txt | AC | 17 ms | 640 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |