Submission #2856850


Source Code Expand

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdlib>
#include<ctime>
using namespace std;
typedef long long ll;
int main() {
	int n, c, k, t[100010], ans = 0;
	cin >> n >> c >> k;
	for (int i = 0; i < n; i++)cin >> t[i];
	sort(t, t + n);
	pair<int, int>cnt;
	cnt.first;//time
	cnt.second = 0;//people
	for (int i = 0; i < n; i++) {
		if (!cnt.second) {
			cnt.first = t[i];
			cnt.second = 1;
			ans++;
		}
		else if (cnt.second == c || t[i] - cnt.first >= k) {
			cnt.first = t[i];
			cnt.second = 1;
			ans++;
		}
		else {
			cnt.second++;
		}
	}
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task A - Airport Bus
User kaage
Language C++14 (GCC 5.4.1)
Score 0
Code Size 705 Byte
Status WA
Exec Time 60 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 11
WA × 1
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 60 ms 640 KB
in3.txt WA 59 ms 640 KB
in4.txt AC 60 ms 640 KB
in5.txt AC 2 ms 256 KB
in6.txt AC 59 ms 640 KB
in7.txt AC 52 ms 640 KB
in8.txt AC 60 ms 640 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB