6080 | 2023-10-29 16:39:55 | Ignác | Szemetessor | cpp11 | Wrong answer 17/100 | 256ms | 8144 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 << "\n";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1808 KiB | ||||
2 | Accepted | 3ms | 1984 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2240 KiB | ||||
4 | Accepted | 3ms | 2444 KiB | ||||
5 | Accepted | 3ms | 2652 KiB | ||||
6 | Accepted | 3ms | 2868 KiB | ||||
7 | Accepted | 3ms | 3112 KiB | ||||
8 | Accepted | 3ms | 3292 KiB | ||||
9 | Accepted | 3ms | 3504 KiB | ||||
10 | Accepted | 3ms | 3744 KiB | ||||
11 | Accepted | 3ms | 3964 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 120ms | 4076 KiB | ||||
13 | Wrong answer | 122ms | 4288 KiB | ||||
14 | Wrong answer | 135ms | 4464 KiB | ||||
15 | Wrong answer | 140ms | 4496 KiB | ||||
16 | Wrong answer | 152ms | 4388 KiB | ||||
17 | Wrong answer | 202ms | 5660 KiB | ||||
18 | Wrong answer | 250ms | 7308 KiB | ||||
19 | Wrong answer | 250ms | 7372 KiB | ||||
20 | Wrong answer | 250ms | 7636 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 126ms | 4924 KiB | ||||
22 | Wrong answer | 150ms | 5508 KiB | ||||
23 | Accepted | 127ms | 4972 KiB | ||||
24 | Wrong answer | 148ms | 5264 KiB | ||||
25 | Accepted | 135ms | 5064 KiB | ||||
26 | Wrong answer | 197ms | 6224 KiB | ||||
27 | Wrong answer | 246ms | 7740 KiB | ||||
28 | Wrong answer | 248ms | 7868 KiB | ||||
29 | Wrong answer | 254ms | 7964 KiB | ||||
30 | Wrong answer | 215ms | 7976 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 2ms | 5140 KiB | ||||
32 | Accepted | 3ms | 5064 KiB | ||||
33 | Accepted | 3ms | 5072 KiB | ||||
34 | Accepted | 3ms | 5064 KiB | ||||
35 | Wrong answer | 14ms | 5260 KiB | ||||
36 | Wrong answer | 141ms | 5084 KiB | ||||
37 | Wrong answer | 256ms | 8144 KiB | ||||
38 | Wrong answer | 252ms | 8124 KiB | ||||
39 | Wrong answer | 254ms | 8120 KiB | ||||
40 | Wrong answer | 252ms | 8124 KiB | ||||
41 | Wrong answer | 252ms | 8124 KiB | ||||
42 | Wrong answer | 254ms | 8120 KiB |