1322021-01-18 18:07:32Valaki2Utazásszervezés (75 pont)cpp14Accepted 75/756ms3976 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, k, m, c;
    cin >> n >> k >> m >> c;
    vector<int> v(c);
    for(int& i : v) cin >> i;
    vector<int> sz(1+n, 0);
    if(k < m) {
        cout << "0\n";
        return 0;
    }
    int vind = 0;
    int db = 0;
    for(int i = 1; i <= k; ++i) {
        while(vind < c) {
            if(v[vind] == i) {
                for(int j = 1; j <= n; ++j) {
                    if(sz[j] <= i) {
                        sz[j] = i + m;
                        ++db;
                        break;
                    }
                }
                ++vind;
            } else break;
        }
    }
    cout << db << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1816 KiB
2Accepted0/06ms2252 KiB
3Accepted3/33ms2308 KiB
4Accepted4/43ms2516 KiB
5Accepted4/43ms2664 KiB
6Accepted4/43ms2872 KiB
7Accepted4/42ms2992 KiB
8Accepted4/43ms3320 KiB
9Accepted5/53ms3528 KiB
10Accepted5/53ms3528 KiB
11Accepted6/64ms3608 KiB
12Accepted6/64ms3896 KiB
13Accepted6/64ms3744 KiB
14Accepted6/64ms3640 KiB
15Accepted6/66ms3896 KiB
16Accepted6/66ms3976 KiB
17Accepted6/66ms3952 KiB