Submission #1156428
Source Code Expand
#include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <vector> #include <queue> #include <map> #include <set> #include <functional> #include <cmath> #include <complex> #include <cctype> #include <cassert> #include <sstream> #include <ctime> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; } template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<pii, int> P; #define INF (1<<29) #define INFL (1ll<<60) #define EPS (1e-8) #define PI (acos(-1)) const ll MOD = 1000000007ll; int main() { int n, c, k; cin >> n >> c >> k; int t[112345]; REP(i, n) scanf("%d", t + i); sort(t, t + n); int ans = 0; bool done[112345] = {}; REP(i, n) { if (done[i]) continue; ll now = t[i] + k; REP(j, c) if (i + j < n && t[i + j] <= now) done[i + j] = true; ans++; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | tkmst201 |
Language | C++14 (Clang 3.8.0) |
Score | 300 |
Code Size | 1225 Byte |
Status | AC |
Exec Time | 1243 ms |
Memory | 1016 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 | 8 ms | 1016 KB |
in2.txt | AC | 20 ms | 768 KB |
in3.txt | AC | 32 ms | 768 KB |
in4.txt | AC | 19 ms | 768 KB |
in5.txt | AC | 2 ms | 384 KB |
in6.txt | AC | 1243 ms | 768 KB |
in7.txt | AC | 17 ms | 768 KB |
in8.txt | AC | 26 ms | 768 KB |
sample1.txt | AC | 1 ms | 384 KB |
sample2.txt | AC | 1 ms | 384 KB |