60192023-10-23 00:13:03hunortakacsUtazásszervezés (75 pont)cpp17Accepted 75/7576ms4180 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N; cin >> N; //vezetok
    int K; cin >> K; //szezon
    int M; cin >> M; //uthossz
    int C; cin >> C; //igenyek

    vector<int> ig(C);
    for(int i=0; i<C; i++) {
        cin >> ig[i]; //novekvo
    }

    int cnt = 0;

    vector<int> utak;
    int prev;
    for(int indul : ig)
    {
        for(int i=0;i<utak.size();i++)
        {
            utak[i] -= (indul - prev); //dt
            if(utak[i] <= 0) {
                utak[i] = 100000;
                N++;
            };
        }

        if(N > 0)
        {
            cnt++;
            N--;
            utak.push_back(M);
        }

        prev = indul;
    }

    cout<<cnt<<"";


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1820 KiB
2Accepted0/076ms2332 KiB
3Accepted3/33ms2284 KiB
4Accepted4/43ms2448 KiB
5Accepted4/43ms2640 KiB
6Accepted4/43ms2848 KiB
7Accepted4/43ms3064 KiB
8Accepted4/43ms3276 KiB
9Accepted5/53ms3368 KiB
10Accepted5/54ms3376 KiB
11Accepted6/614ms3552 KiB
12Accepted6/646ms3536 KiB
13Accepted6/643ms3572 KiB
14Accepted6/671ms3900 KiB
15Accepted6/676ms4012 KiB
16Accepted6/676ms4180 KiB
17Accepted6/676ms3932 KiB