59002023-10-04 19:06:02mraronUtazásszervezés (75 pont)cpp17Accepted 75/754ms4384 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;
    
    vector<int> a(k+1, 0);
    int x;
    int maxi=0;
    if(n>c)
    {
        cout<<c;
        return;
    }
    for(int i=0; i<c; i++)
    {
        cin>>x;
        if(x<k+1 && a[x]<n) 
        {
            maxi++;
            for(int j=x; j<min(k+1, x+m); j++)   a[j]++;
        }
    } 
    cout<<maxi<<"\n";
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1828 KiB
2Accepted0/04ms2260 KiB
3Accepted3/32ms2268 KiB
4Accepted4/42ms2360 KiB
5Accepted4/43ms2560 KiB
6Accepted4/43ms2768 KiB
7Accepted4/43ms2984 KiB
8Accepted4/43ms3364 KiB
9Accepted5/53ms3688 KiB
10Accepted5/53ms3808 KiB
11Accepted6/63ms3892 KiB
12Accepted6/64ms3772 KiB
13Accepted6/63ms4028 KiB
14Accepted6/64ms3984 KiB
15Accepted6/64ms4240 KiB
16Accepted6/64ms4132 KiB
17Accepted6/64ms4384 KiB