58912023-10-04 18:19:12gergomiszoriUtazásszervezés (75 pont)cpp11Wrong answer 19/756ms4024 KiB
#include <bits/stdc++.h>

using namespace std;

int tel;
int n, k, m, c;
int ind;
vector<int> igenyek;
vector<int> veg;

int main()
{
    cin >> n >> k >> m >> c;
    igenyek.resize(c);
    veg.resize(k+1);

    for(int i = 0; i < c; i++) cin >> igenyek[i];

    for(int i = 1; i < k+1; i++)
    {
        if(ind == igenyek.size())
            break;
        n += veg[i];
        while(ind < igenyek.size() && igenyek[ind] < i) ind++;
        int tempn = n;
        for(int j = 0; j < tempn; j++)
        {
            if(igenyek[ind] == i)
            {
                ind++; tel++; n--; veg[i+m-1] += 1;
                if(ind == igenyek.size())
                    break;
            }
            else
                break;
        }
    }


    cout << tel;


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base19/75
1Accepted0/03ms1880 KiB
2Wrong answer0/06ms2312 KiB
3Accepted3/32ms2152 KiB
4Accepted4/43ms2396 KiB
5Accepted4/42ms2488 KiB
6Accepted4/42ms2708 KiB
7Accepted4/43ms2912 KiB
8Wrong answer0/43ms3192 KiB
9Wrong answer0/53ms3320 KiB
10Wrong answer0/53ms3432 KiB
11Wrong answer0/64ms3560 KiB
12Wrong answer0/64ms3652 KiB
13Wrong answer0/64ms3536 KiB
14Wrong answer0/66ms3800 KiB
15Wrong answer0/66ms3760 KiB
16Wrong answer0/66ms4024 KiB
17Wrong answer0/66ms3976 KiB