58662023-10-04 17:22:43horkaUtazásszervezés (75 pont)cpp11Wrong answer 8/756ms4124 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+1);
	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/03ms1808 KiB
2Wrong answer0/06ms2508 KiB
3Wrong answer0/32ms2144 KiB
4Wrong answer0/42ms2244 KiB
5Accepted4/42ms2204 KiB
6Accepted4/42ms2204 KiB
7Wrong answer0/43ms2444 KiB
8Wrong answer0/43ms2792 KiB
9Wrong answer0/53ms3160 KiB
10Wrong answer0/53ms3224 KiB
11Wrong answer0/64ms3332 KiB
12Wrong answer0/64ms3740 KiB
13Wrong answer0/64ms3704 KiB
14Wrong answer0/64ms3832 KiB
15Wrong answer0/66ms3848 KiB
16Wrong answer0/66ms4072 KiB
17Wrong answer0/66ms4124 KiB