58842023-10-04 18:10:02mmatedUtazásszervezés (75 pont)cpp17Accepted 75/754ms3996 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+1]={0};
    int x;
    int maxi=0;
    //f(i,0,c)
    int b[c];
    f(i,0,c) cin>>b[i];
    sort(b,b+c);   
    for(int i=0; i<c; i++)
    {
        if(a[b[i]]<n) 
        {
            maxi++;
            f(j,b[i],b[i]+m)    a[j]++;
        }
    } 
    //f(i,1,k+1)  cout<<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/03ms1888 KiB
2Accepted0/04ms2368 KiB
3Accepted3/33ms2312 KiB
4Accepted4/43ms2540 KiB
5Accepted4/43ms2772 KiB
6Accepted4/43ms2876 KiB
7Accepted4/42ms2944 KiB
8Accepted4/43ms3236 KiB
9Accepted5/53ms3844 KiB
10Accepted5/53ms3628 KiB
11Accepted6/63ms3792 KiB
12Accepted6/64ms3988 KiB
13Accepted6/64ms3928 KiB
14Accepted6/64ms3932 KiB
15Accepted6/64ms3996 KiB
16Accepted6/64ms3996 KiB
17Accepted6/64ms3996 KiB