58952023-10-04 18:32:57CZHUtazásszervezés (75 pont)cpp14Accepted 75/756ms3832 KiB
#include <bits/stdc++.h>
#include <vector>
using namespace std;

int main() {
	int n, k, m, c;
	cin >> n >> k >> m >> c;
	int cur = 0;
	int szabad = n;
	int sikeres = 0; 
	vector<int> vissza = {};
	for (int i = 0; i < c; i++) {
		cin >> cur;
		for (int j = 0; j < vissza.size(); j++) {
			if (vissza[j] <= cur) {
				szabad++;
				vissza.erase(vissza.begin());
			} else {
				break;
			}
		}
		if (szabad > 0) {
			sikeres++;

			szabad--;
			vissza.push_back(cur+m);
		}
	}
	cout << sikeres;
	
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1960 KiB
2Accepted0/06ms2004 KiB
3Accepted3/33ms2176 KiB
4Accepted4/42ms2320 KiB
5Accepted4/43ms2532 KiB
6Accepted4/43ms2616 KiB
7Accepted4/43ms2808 KiB
8Accepted4/43ms2948 KiB
9Accepted5/53ms2824 KiB
10Accepted5/53ms2952 KiB
11Accepted6/64ms3032 KiB
12Accepted6/64ms3164 KiB
13Accepted6/64ms3248 KiB
14Accepted6/66ms3376 KiB
15Accepted6/66ms3584 KiB
16Accepted6/66ms3828 KiB
17Accepted6/66ms3832 KiB