58752023-10-04 17:41:15mmatedUtazásszervezés (75 pont)cpp17Accepted 75/754ms4468 KiB
#include <bits/stdc++.h>
using namespace std;
#define f(i,k,n) for(int i=k; i<n; i++)
#define ll long long
const int inf = INT_MAX;

void solve()
{
    int n,k,m,c;
    cin>>n>>k>>m>>c;
    int a[k+m+1]={0};
    int x;
    int maxi=0;

    f(i,0,c)
    {
        cin>>x;
        if(a[x]<n) 
        {
            maxi++;
            f(j,x,x+m)    a[j]++;
        }
    } 
    //f(i,1,k+m)    cout<<a[i];
    //f(i,0,k+m)  if(maxi<a[i])   maxi=a[i];
    cout<<maxi;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1892 KiB
2Accepted0/04ms2288 KiB
3Accepted3/33ms2296 KiB
4Accepted4/43ms2508 KiB
5Accepted4/43ms2732 KiB
6Accepted4/43ms3100 KiB
7Accepted4/43ms3208 KiB
8Accepted4/43ms3476 KiB
9Accepted5/53ms3564 KiB
10Accepted5/53ms3916 KiB
11Accepted6/63ms3836 KiB
12Accepted6/63ms3984 KiB
13Accepted6/63ms4212 KiB
14Accepted6/64ms4424 KiB
15Accepted6/64ms4448 KiB
16Accepted6/64ms4456 KiB
17Accepted6/64ms4468 KiB