70782023-12-29 19:52:35MagyarKendeSZLGUtazásszervezés (75 pont)cpp17Accepted 75/754ms3840 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)
#define cinv(v) for (auto& e : v) cin >> e;
#define all(v) v.begin(), v.end()
#define has(s, e) s.count(e)

using namespace std;

int main() {
    speed;

    int N, K, M, C, result = 0;
    cin >> N >> K >> M >> C;
    vector<vector<int>> agentS(N, vector<int>({0}));
    while (C--) {
        int T, min_gap = K, min_i = -1;
        cin >> T;
        for (int i = 0; i < N; i++) {
            int gap = T - agentS[i].back();
            if (0 < gap && gap < min_gap) {
                min_gap = gap;
                min_i = i;
            }
        }

        if (min_i != -1) {
            result++;
            agentS[min_i].push_back(T + M - 1);
        }
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1828 KiB
2Accepted0/04ms2276 KiB
3Accepted3/33ms2228 KiB
4Accepted4/43ms2316 KiB
5Accepted4/43ms2452 KiB
6Accepted4/43ms2692 KiB
7Accepted4/43ms2772 KiB
8Accepted4/43ms2900 KiB
9Accepted5/53ms3120 KiB
10Accepted5/53ms3224 KiB
11Accepted6/63ms3216 KiB
12Accepted6/64ms3428 KiB
13Accepted6/64ms3400 KiB
14Accepted6/64ms3404 KiB
15Accepted6/64ms3668 KiB
16Accepted6/64ms3832 KiB
17Accepted6/64ms3840 KiB