58542023-10-04 14:00:06kidesoUtazásszervezés (75 pont)cpp17Accepted 75/756ms4100 KiB
#include <iostream>

using namespace std;

int N, M, K, C, a, db, k;
int foglalt[11];

int keres(int a) {
    for(int i = 1; i <= N; ++i) {
        if(foglalt[i] <= a) {
            return i;
        }
    }

    return 0;
}

int main() {
    cin >> N >> K >> M >> C;
    for(int i = 1; i <= N; ++i) {
        foglalt[i] = 0;
    }

    for(int i = 1; i <= C; ++i) {
        cin >> a;
        k = keres(a);

        if(k != 0) {
            ++db;
            foglalt[k] = a + M;
        }
    }

    cout << db << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1876 KiB
2Accepted0/06ms2084 KiB
3Accepted3/33ms2296 KiB
4Accepted4/42ms2508 KiB
5Accepted4/42ms2752 KiB
6Accepted4/43ms2932 KiB
7Accepted4/42ms3012 KiB
8Accepted4/43ms3132 KiB
9Accepted5/53ms3384 KiB
10Accepted5/53ms3384 KiB
11Accepted6/64ms3512 KiB
12Accepted6/64ms3560 KiB
13Accepted6/64ms3560 KiB
14Accepted6/66ms3804 KiB
15Accepted6/66ms3928 KiB
16Accepted6/66ms4020 KiB
17Accepted6/66ms4100 KiB