Submission #1441086
Source Code Expand
#include <iostream> #include <queue> #include <vector> using namespace std; typedef unsigned long long u64; int main(void) { cin.tie(0); ios::sync_with_stdio(false); u64 n, c, k; cin >> n >> c >> k; priority_queue< u64, vector< u64 >, greater< u64 > > q; for (u64 i = 0; i < n; ++i) { u64 t; cin >> t; q.push(t); } u64 wait = q.top(); u64 w_n = 1; u64 b_cnt = 0; q.pop(); while (!q.empty()) { while (w_n < c && !q.empty()) { u64 next = q.top(); if (next > wait+k) { break; } w_n++; q.pop(); } if (q.empty()) break; b_cnt++; wait = q.top(); q.pop(); w_n = 1; } if (w_n>0) b_cnt++; cout << b_cnt << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | knk |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 769 Byte |
Status | AC |
Exec Time | 23 ms |
Memory | 1400 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 | 23 ms | 1400 KB |
in3.txt | AC | 23 ms | 1400 KB |
in4.txt | AC | 23 ms | 1400 KB |
in5.txt | AC | 2 ms | 256 KB |
in6.txt | AC | 23 ms | 1400 KB |
in7.txt | AC | 20 ms | 1400 KB |
in8.txt | AC | 23 ms | 1400 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |