62282023-11-08 12:01:50GhostSzemetessorcpp17Wrong answer 17/100245ms7560 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, k, capacity, type, amount, i, out = 0;
    cin >> n >> k;

    vector<pair<int, int>> trash(n, { 0,0 });
    for (i = 0; i < n; i++) {
        cin >> trash[i].second;
    }

    for (i = 0; i < k; i++) {
        cin >> type >> amount;
        if (trash[type].first + amount < trash[type].second) {
            trash[type].first += amount;
        }
        else {
            out += trash[type].second - trash[type].first;
            trash[type].first = amount;
        }
    }
    for (i = 0; i < n; i++) {
        if (trash[i].first > 0) {
            out += trash[i].second - trash[i].first;
        }
    }

    cout << out;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1716 KiB
2Accepted3ms2112 KiB
subtask217/17
3Accepted3ms2136 KiB
4Accepted2ms2216 KiB
5Accepted2ms2464 KiB
6Accepted2ms2572 KiB
7Accepted2ms2656 KiB
8Accepted2ms2784 KiB
9Accepted2ms2844 KiB
10Accepted2ms2848 KiB
11Accepted3ms2784 KiB
subtask30/25
12Wrong answer118ms3020 KiB
13Wrong answer119ms3144 KiB
14Wrong answer131ms3280 KiB
15Wrong answer136ms3324 KiB
16Wrong answer148ms3484 KiB
17Wrong answer194ms4676 KiB
18Wrong answer241ms6576 KiB
19Wrong answer244ms6548 KiB
20Wrong answer240ms6524 KiB
subtask40/20
21Wrong answer125ms3820 KiB
22Wrong answer145ms4540 KiB
23Wrong answer128ms4000 KiB
24Wrong answer144ms4116 KiB
25Wrong answer131ms4164 KiB
26Wrong answer190ms5568 KiB
27Wrong answer236ms6912 KiB
28Wrong answer238ms7072 KiB
29Wrong answer238ms7140 KiB
30Wrong answer209ms7252 KiB
subtask50/38
31Accepted3ms4124 KiB
32Wrong answer2ms4248 KiB
33Accepted3ms4360 KiB
34Accepted3ms4396 KiB
35Wrong answer14ms4760 KiB
36Wrong answer136ms4536 KiB
37Wrong answer245ms7560 KiB
38Wrong answer241ms7440 KiB
39Wrong answer244ms7436 KiB
40Wrong answer244ms7328 KiB
41Wrong answer243ms7328 KiB
42Wrong answer243ms7472 KiB