6232 | 2023-11-08 12:07:13 | Ghost | Szemetessor | cpp17 | Wrong answer 17/100 | 246ms | 7816 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 if (trash[type].first + amount == trash[type].second) {
trash[type].first = 0;
}
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 | 1680 KiB | ||||
2 | Accepted | 2ms | 1848 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 2ms | 1928 KiB | ||||
4 | Accepted | 2ms | 2056 KiB | ||||
5 | Accepted | 2ms | 2148 KiB | ||||
6 | Accepted | 3ms | 2272 KiB | ||||
7 | Accepted | 3ms | 2512 KiB | ||||
8 | Accepted | 3ms | 2696 KiB | ||||
9 | Accepted | 3ms | 2936 KiB | ||||
10 | Accepted | 2ms | 2992 KiB | ||||
11 | Accepted | 2ms | 3120 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 118ms | 3364 KiB | ||||
13 | Wrong answer | 118ms | 3448 KiB | ||||
14 | Wrong answer | 130ms | 3732 KiB | ||||
15 | Wrong answer | 136ms | 3664 KiB | ||||
16 | Wrong answer | 148ms | 3552 KiB | ||||
17 | Wrong answer | 194ms | 5004 KiB | ||||
18 | Wrong answer | 246ms | 6760 KiB | ||||
19 | Wrong answer | 243ms | 6944 KiB | ||||
20 | Wrong answer | 240ms | 7140 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 123ms | 4144 KiB | ||||
22 | Wrong answer | 143ms | 4816 KiB | ||||
23 | Accepted | 125ms | 4372 KiB | ||||
24 | Wrong answer | 143ms | 4308 KiB | ||||
25 | Accepted | 131ms | 4492 KiB | ||||
26 | Wrong answer | 190ms | 5816 KiB | ||||
27 | Wrong answer | 234ms | 7492 KiB | ||||
28 | Wrong answer | 237ms | 7656 KiB | ||||
29 | Wrong answer | 238ms | 7696 KiB | ||||
30 | Wrong answer | 217ms | 7696 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4672 KiB | ||||
32 | Accepted | 3ms | 4552 KiB | ||||
33 | Accepted | 3ms | 4672 KiB | ||||
34 | Accepted | 3ms | 4548 KiB | ||||
35 | Wrong answer | 14ms | 4624 KiB | ||||
36 | Wrong answer | 136ms | 4604 KiB | ||||
37 | Wrong answer | 243ms | 7768 KiB | ||||
38 | Wrong answer | 246ms | 7712 KiB | ||||
39 | Wrong answer | 244ms | 7668 KiB | ||||
40 | Wrong answer | 241ms | 7816 KiB | ||||
41 | Wrong answer | 246ms | 7668 KiB | ||||
42 | Wrong answer | 243ms | 7672 KiB |