58362023-10-03 17:37:08Vkrisztian01Utazásszervezés (75 pont)cpp11Accepted 75/758ms4828 KiB
#include <iostream>
#include<vector>
#include<queue>

using namespace std;

int main()
{
    int n, szezon, hossz, c,db=0;
    cin>>n>>szezon>>hossz>>c;
    priority_queue<pair<int,bool> > seged;
    while(c)
    {
        --c;
        int x;
        cin>>x;
        seged.push(make_pair(-x,false));
    }
    while(!seged.empty())
    {
        if(seged.top().second)
        {
            n++;
            seged.pop();
        }
        else
        {
            if(n>0)
            {
               db++;
               --n;
               seged.push(make_pair(seged.top().first-hossz,true));
            }
            seged.pop();
        }

    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1816 KiB
2Accepted0/08ms2428 KiB
3Accepted3/32ms2216 KiB
4Accepted4/43ms2464 KiB
5Accepted4/43ms2672 KiB
6Accepted4/43ms2912 KiB
7Accepted4/42ms2992 KiB
8Accepted4/43ms3200 KiB
9Accepted5/53ms3660 KiB
10Accepted5/54ms3684 KiB
11Accepted6/64ms4076 KiB
12Accepted6/67ms4348 KiB
13Accepted6/67ms4428 KiB
14Accepted6/68ms4828 KiB
15Accepted6/68ms4668 KiB
16Accepted6/68ms4664 KiB
17Accepted6/68ms4668 KiB