6228 | 2023-11-08 12:01:50 | Ghost | Szemetessor | cpp17 | Wrong answer 17/100 | 245ms | 7560 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1716 KiB | ||||
2 | Accepted | 3ms | 2112 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2136 KiB | ||||
4 | Accepted | 2ms | 2216 KiB | ||||
5 | Accepted | 2ms | 2464 KiB | ||||
6 | Accepted | 2ms | 2572 KiB | ||||
7 | Accepted | 2ms | 2656 KiB | ||||
8 | Accepted | 2ms | 2784 KiB | ||||
9 | Accepted | 2ms | 2844 KiB | ||||
10 | Accepted | 2ms | 2848 KiB | ||||
11 | Accepted | 3ms | 2784 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 118ms | 3020 KiB | ||||
13 | Wrong answer | 119ms | 3144 KiB | ||||
14 | Wrong answer | 131ms | 3280 KiB | ||||
15 | Wrong answer | 136ms | 3324 KiB | ||||
16 | Wrong answer | 148ms | 3484 KiB | ||||
17 | Wrong answer | 194ms | 4676 KiB | ||||
18 | Wrong answer | 241ms | 6576 KiB | ||||
19 | Wrong answer | 244ms | 6548 KiB | ||||
20 | Wrong answer | 240ms | 6524 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 125ms | 3820 KiB | ||||
22 | Wrong answer | 145ms | 4540 KiB | ||||
23 | Wrong answer | 128ms | 4000 KiB | ||||
24 | Wrong answer | 144ms | 4116 KiB | ||||
25 | Wrong answer | 131ms | 4164 KiB | ||||
26 | Wrong answer | 190ms | 5568 KiB | ||||
27 | Wrong answer | 236ms | 6912 KiB | ||||
28 | Wrong answer | 238ms | 7072 KiB | ||||
29 | Wrong answer | 238ms | 7140 KiB | ||||
30 | Wrong answer | 209ms | 7252 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4124 KiB | ||||
32 | Wrong answer | 2ms | 4248 KiB | ||||
33 | Accepted | 3ms | 4360 KiB | ||||
34 | Accepted | 3ms | 4396 KiB | ||||
35 | Wrong answer | 14ms | 4760 KiB | ||||
36 | Wrong answer | 136ms | 4536 KiB | ||||
37 | Wrong answer | 245ms | 7560 KiB | ||||
38 | Wrong answer | 241ms | 7440 KiB | ||||
39 | Wrong answer | 244ms | 7436 KiB | ||||
40 | Wrong answer | 244ms | 7328 KiB | ||||
41 | Wrong answer | 243ms | 7328 KiB | ||||
42 | Wrong answer | 243ms | 7472 KiB |