21992023-01-02 12:11:08zalan0323Utazásszervezés (75 pont)cpp11Accepted 75/756ms4516 KiB
// Source: https://usaco.guide/general/io

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

int main() {
	int n, k, m, c;
	cin >> n >> k >> m >> c;
	vector<int> a(c);
	for(int i = 0; i<c; i++){
		cin >> a[i];
	}
	int foglalt = 0;
	int elvihetocsapat = 0;
	vector<int> veg;
	int vk = 0;
	for(int i = 0; i<c; i++){
		if(vk < veg.size() && veg[vk]<a[i]){
			foglalt--;
			vk++;
		}
		if(n-foglalt>0){
			elvihetocsapat++;
			foglalt++;
			veg.push_back(a[i]+(m-1));
		}
	}
	cout << elvihetocsapat;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1808 KiB
2Accepted0/06ms2288 KiB
3Accepted3/33ms2252 KiB
4Accepted4/43ms2448 KiB
5Accepted4/43ms2804 KiB
6Accepted4/43ms2880 KiB
7Accepted4/42ms2984 KiB
8Accepted4/43ms3188 KiB
9Accepted5/53ms3444 KiB
10Accepted5/53ms3540 KiB
11Accepted6/64ms3592 KiB
12Accepted6/64ms3888 KiB
13Accepted6/64ms3920 KiB
14Accepted6/66ms4108 KiB
15Accepted6/66ms4204 KiB
16Accepted6/66ms4252 KiB
17Accepted6/66ms4516 KiB