6076 | 2023-10-29 16:29:12 | Ignác | Szemetessor | cpp11 | Wrong answer 17/100 | 266ms | 108108 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> C(N);
for(int i = 0; i < N; i++){
cin >> C[i];
}
vector<int> teli(N);
int ar = 0;
for(int i = 0; i < K; i++){
int T, Q;
cin >> T >> Q;
if(teli[T] + Q > C[T]){
ar += C[T] - teli[T];
teli[T] = 0;
}
teli[T] += Q;
}
for(int i = 0; i < N; i++){
if(teli[i] > 0){
ar += C[i] - teli[i];
}
}
cout << ar;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1936 KiB | ||||
2 | Accepted | 3ms | 1908 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2112 KiB | ||||
4 | Accepted | 3ms | 2332 KiB | ||||
5 | Accepted | 3ms | 2544 KiB | ||||
6 | Accepted | 3ms | 2792 KiB | ||||
7 | Accepted | 3ms | 2876 KiB | ||||
8 | Accepted | 3ms | 3156 KiB | ||||
9 | Accepted | 3ms | 3132 KiB | ||||
10 | Accepted | 3ms | 3176 KiB | ||||
11 | Accepted | 3ms | 3156 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 123ms | 5216 KiB | ||||
13 | Wrong answer | 125ms | 7288 KiB | ||||
14 | Wrong answer | 140ms | 9792 KiB | ||||
15 | Wrong answer | 143ms | 12480 KiB | ||||
16 | Wrong answer | 157ms | 15704 KiB | ||||
17 | Wrong answer | 208ms | 21244 KiB | ||||
18 | Wrong answer | 259ms | 28052 KiB | ||||
19 | Wrong answer | 261ms | 33132 KiB | ||||
20 | Wrong answer | 256ms | 38276 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 129ms | 37672 KiB | ||||
22 | Wrong answer | 149ms | 41024 KiB | ||||
23 | Accepted | 129ms | 42592 KiB | ||||
24 | Wrong answer | 156ms | 45952 KiB | ||||
25 | Accepted | 137ms | 48392 KiB | ||||
26 | Wrong answer | 202ms | 53492 KiB | ||||
27 | Wrong answer | 252ms | 59892 KiB | ||||
28 | Wrong answer | 252ms | 65164 KiB | ||||
29 | Wrong answer | 254ms | 70196 KiB | ||||
30 | Wrong answer | 219ms | 74160 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 71432 KiB | ||||
32 | Accepted | 2ms | 71552 KiB | ||||
33 | Accepted | 3ms | 71556 KiB | ||||
34 | Accepted | 3ms | 71552 KiB | ||||
35 | Wrong answer | 14ms | 71892 KiB | ||||
36 | Wrong answer | 144ms | 74608 KiB | ||||
37 | Wrong answer | 259ms | 82688 KiB | ||||
38 | Wrong answer | 261ms | 87784 KiB | ||||
39 | Wrong answer | 263ms | 92980 KiB | ||||
40 | Wrong answer | 261ms | 97936 KiB | ||||
41 | Wrong answer | 266ms | 103028 KiB | ||||
42 | Wrong answer | 263ms | 108108 KiB |