11661 | 2024-11-04 11:41:36 | bzy | Szemetessor | cpp17 | Wrong answer 25/100 | 250ms | 6972 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int n, k; cin >> n >> k;
vector <int> C(n);
for(int &c : C) cin >> c;
ll ans = 0;
vector <int> K(n, 0);
for(int i = 0; i < k; i++){
int t, q; cin >> t >> q;
if(K[t] + q <= C[t]) K[t] += q;
else{
ans += C[t] - K[t];
K[t] = q;
}
}
for(int i = 0; i < n; i++) ans += C[i] - K[i];
cout << ans;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 320 KiB | ||||
2 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 1ms | 320 KiB | ||||
4 | Accepted | 1ms | 320 KiB | ||||
5 | Accepted | 1ms | 320 KiB | ||||
6 | Wrong answer | 1ms | 320 KiB | ||||
7 | Accepted | 1ms | 320 KiB | ||||
8 | Accepted | 1ms | 404 KiB | ||||
9 | Wrong answer | 1ms | 408 KiB | ||||
10 | Accepted | 1ms | 320 KiB | ||||
11 | Wrong answer | 1ms | 320 KiB | ||||
subtask3 | 25/25 | ||||||
12 | Accepted | 119ms | 2432 KiB | ||||
13 | Accepted | 118ms | 2364 KiB | ||||
14 | Accepted | 133ms | 2828 KiB | ||||
15 | Accepted | 137ms | 2844 KiB | ||||
16 | Accepted | 150ms | 3280 KiB | ||||
17 | Accepted | 202ms | 5016 KiB | ||||
18 | Accepted | 247ms | 6948 KiB | ||||
19 | Accepted | 247ms | 6940 KiB | ||||
20 | Accepted | 246ms | 6972 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 122ms | 2620 KiB | ||||
22 | Wrong answer | 145ms | 3384 KiB | ||||
23 | Wrong answer | 125ms | 2616 KiB | ||||
24 | Wrong answer | 145ms | 3380 KiB | ||||
25 | Wrong answer | 133ms | 2896 KiB | ||||
26 | Wrong answer | 195ms | 4920 KiB | ||||
27 | Wrong answer | 241ms | 6596 KiB | ||||
28 | Wrong answer | 248ms | 6676 KiB | ||||
29 | Wrong answer | 244ms | 6712 KiB | ||||
30 | Wrong answer | 215ms | 5944 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 2ms | 320 KiB | ||||
32 | Accepted | 1ms | 320 KiB | ||||
33 | Wrong answer | 1ms | 320 KiB | ||||
34 | Wrong answer | 1ms | 320 KiB | ||||
35 | Wrong answer | 13ms | 720 KiB | ||||
36 | Wrong answer | 138ms | 2872 KiB | ||||
37 | Wrong answer | 250ms | 6944 KiB | ||||
38 | Wrong answer | 250ms | 6876 KiB | ||||
39 | Wrong answer | 250ms | 6812 KiB | ||||
40 | Wrong answer | 248ms | 6968 KiB | ||||
41 | Wrong answer | 248ms | 6968 KiB | ||||
42 | Wrong answer | 248ms | 6940 KiB |