147632025-02-02 10:32:43TakacsAndrasUtazásszervezés (75 pont)cpp17Wrong answer 19/754ms780 KiB
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,k,m,c; cin >> n >> k >> m >> c;
    vector<pair<int,int>> a(k+1);
    for (int i = 0; i < c; i++) {
        int x; cin >> x;
        a[x].first += 1;
    }
    int out = 0;
    for (int i = 1; i <= k; i++) {
        n += a[i].second;
        if (a[i].first >= 1 && n > 0) {
            out += min(a[i].first,n);
            a[i+m-1].second = min(a[i].first,n);
            n -= min(a[i].first,n);
        }
    }
    cout << out;
}
SubtaskSumTestVerdictTimeMemory
base19/75
1Accepted0/01ms316 KiB
2Wrong answer0/04ms780 KiB
3Accepted3/31ms316 KiB
4Accepted4/41ms316 KiB
5Accepted4/41ms316 KiB
6Accepted4/41ms316 KiB
7Accepted4/41ms316 KiB
8Wrong answer0/41ms316 KiB
9Wrong answer0/52ms404 KiB
10Wrong answer0/52ms540 KiB
11Wrong answer0/62ms316 KiB
12Wrong answer0/64ms572 KiB
13Wrong answer0/63ms412 KiB
14Wrong answer0/64ms756 KiB
15Wrong answer0/64ms564 KiB
16Wrong answer0/64ms624 KiB
17Wrong answer0/64ms564 KiB