59132023-10-05 16:13:17SzBenceUtazásszervezés (75 pont)cpp17Accepted 75/756ms3844 KiB
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,m,c;
    cin >> n >> k >> m >> c;
    vector<int>p(c);
    for(int i = 0; i < p.size(); i++){
        cin >> p[i];
    }
    vector<int>v(n);
    int szv = n, j = 0;
    int db = 0;
    for(int i = 1; i <= k-m+1; i++)
    {
        while(j < c && p[j] <= i){
            if(p[j] == i){
                sort(v.begin(),v.end());
                if(v[0] == 0) {
                    v[0] =m;
                    db++;
                }
            }

            
            j++;
        }
        for(int l = 0; l < v.size(); l++) if(v[l] != 0)v[l]--;
    }
    cout << db;

}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1684 KiB
2Accepted0/06ms2012 KiB
3Accepted3/33ms2184 KiB
4Accepted4/42ms2268 KiB
5Accepted4/42ms2360 KiB
6Accepted4/42ms2484 KiB
7Accepted4/43ms2724 KiB
8Accepted4/43ms3124 KiB
9Accepted5/53ms3044 KiB
10Accepted5/53ms3112 KiB
11Accepted6/64ms3260 KiB
12Accepted6/64ms3380 KiB
13Accepted6/66ms3592 KiB
14Accepted6/66ms3672 KiB
15Accepted6/66ms3672 KiB
16Accepted6/66ms3584 KiB
17Accepted6/66ms3844 KiB