59742023-10-07 20:20:21neszbalUtazásszervezés (75 pont)cpp17Wrong answer 35/756ms4444 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int getIndex(vector<int> v, int X) {
    auto it = find(v.begin(), v.end(), X);
    if (it != v.end()) {
        int index = it - v.begin();
        return index;
    }
    else {
        return -1;
    }
}



int main() {
    /*  2 10 4 6
        1 2 2 5 6 7
    */

    int N, K, M, C, a=0;

    cin >> N >> K >> M >> C;
    vector<int> igenyek(C);
    vector<int> kiserok(N, -1);

    for (int i = 0; i < C; i++) {
        cin >> igenyek[i];
    }

    for(int i=0; i<C; i++) {


        int idegenvezeto = getIndex(kiserok, -1);
        if (idegenvezeto != -1) {
            kiserok[idegenvezeto] = igenyek[i]+M-1;
            a++;
        }
        for (int j = 0; j < N; j++) {
            if(kiserok[j] < igenyek[i]) {
                kiserok[j] = igenyek[i] + M - 1;
                a++;
                break;
            }
        }
         

            
        
        
        

    }


    cout << a << endl;



    return 0;
}
SubtaskSumTestVerdictTimeMemory
base35/75
1Accepted0/03ms1808 KiB
2Wrong answer0/06ms2228 KiB
3Accepted3/33ms2552 KiB
4Accepted4/42ms2576 KiB
5Accepted4/43ms2784 KiB
6Accepted4/42ms2992 KiB
7Accepted4/42ms3116 KiB
8Wrong answer0/43ms3260 KiB
9Accepted5/53ms3512 KiB
10Accepted5/53ms3532 KiB
11Wrong answer0/64ms3544 KiB
12Wrong answer0/64ms3816 KiB
13Accepted6/64ms4024 KiB
14Wrong answer0/66ms4356 KiB
15Wrong answer0/66ms4444 KiB
16Wrong answer0/66ms4400 KiB
17Wrong answer0/66ms4404 KiB