58792023-10-04 17:49:41horkaUtazásszervezés (75 pont)cpp11Wrong answer 8/756ms4240 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int vez,k,m,c; cin>>vez>>k>>m>>c;
	vector<int> igeny(c+1),napok(k+2);
	for(int i=1; i<=c; i++)
		{
			cin>>igeny[i];
			napok[igeny[i]]++;
		}
	vector<int> novel(k+2);
	int mo=0;
	for(int i=1; i<=k; i++)
	{
		vez+=novel[i];
		if(napok[i]==0 || vez==0) continue;
		if(napok[i]>=vez)
		{
			novel[i+m+1]+=vez;
			mo+=vez;
			vez=0;
		}
		else
		{
			novel[i+m+1]+=napok[i];
			mo+=napok[i];
			vez-=napok[i];
		}
	}
	cout<<mo<<endl;
}
SubtaskSumTestVerdictTimeMemory
base8/75
1Accepted0/03ms1684 KiB
2Wrong answer0/06ms2312 KiB
3Wrong answer0/33ms2072 KiB
4Wrong answer0/43ms2280 KiB
5Accepted4/43ms2556 KiB
6Accepted4/42ms2624 KiB
7Wrong answer0/42ms2712 KiB
8Wrong answer0/43ms3160 KiB
9Wrong answer0/53ms3016 KiB
10Wrong answer0/53ms3300 KiB
11Wrong answer0/64ms3532 KiB
12Wrong answer0/64ms3912 KiB
13Wrong answer0/64ms4128 KiB
14Wrong answer0/66ms4240 KiB
15Wrong answer0/66ms4092 KiB
16Wrong answer0/66ms4140 KiB
17Wrong answer0/66ms4188 KiB