90162024-02-12 10:39:17IgnácUtazásszervezés (75 pont)cpp17Accepted 75/756ms3956 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
#include <queue>
using namespace std;

int main() {
	int n, k, m, c;
	cin >> n >> k >> m >> c;
	priority_queue<int> end;
	int db = 0;
	for (int i = 0; i < c; i++) {
		int ig;
		cin >> ig;
		while (end.size() > 0 && end.top() >= -ig) end.pop();
		if (end.size() < n) {
			db++;
			end.push(-ig - m);
		}
	}

	cout << db;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms2088 KiB
2Accepted0/06ms2312 KiB
3Accepted3/33ms2572 KiB
4Accepted4/42ms2520 KiB
5Accepted4/43ms2708 KiB
6Accepted4/43ms2828 KiB
7Accepted4/43ms3168 KiB
8Accepted4/43ms3168 KiB
9Accepted5/53ms3248 KiB
10Accepted5/53ms3380 KiB
11Accepted6/64ms3596 KiB
12Accepted6/64ms3672 KiB
13Accepted6/64ms3700 KiB
14Accepted6/66ms3688 KiB
15Accepted6/66ms3956 KiB
16Accepted6/66ms3868 KiB
17Accepted6/66ms3884 KiB