6197 | 2023-11-06 18:16:55 | horvathabel | Szemetessor | cpp17 | Wrong answer 25/100 | 256ms | 12092 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
int n,k;
cin>>n>>k;
vector<ll> s(n+1,0);
vector<ll> l;
for (int i=0;i<n;i++){
int x;
cin>>x;
l.push_back(x);
}
ll ans=0;
for (int i=0; i<k;i++){
ll x,y;
cin>>x>>y;
if (s[x]+y>l[x]){
ans+=l[x]-s[x];
s[x]=y;
}
else s[x]+=y;
}
for (int i=0; i<n;i++) ans+=l[i]-s[i];
cout<<ans;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1684 KiB | ||||
2 | Accepted | 3ms | 1996 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 3ms | 2048 KiB | ||||
4 | Accepted | 2ms | 2056 KiB | ||||
5 | Accepted | 3ms | 2184 KiB | ||||
6 | Wrong answer | 3ms | 2272 KiB | ||||
7 | Accepted | 3ms | 2400 KiB | ||||
8 | Accepted | 3ms | 2760 KiB | ||||
9 | Wrong answer | 2ms | 2848 KiB | ||||
10 | Accepted | 2ms | 2840 KiB | ||||
11 | Wrong answer | 2ms | 2968 KiB | ||||
subtask3 | 25/25 | ||||||
12 | Accepted | 119ms | 3092 KiB | ||||
13 | Accepted | 120ms | 3508 KiB | ||||
14 | Accepted | 133ms | 3604 KiB | ||||
15 | Accepted | 138ms | 3740 KiB | ||||
16 | Accepted | 150ms | 4164 KiB | ||||
17 | Accepted | 201ms | 7320 KiB | ||||
18 | Accepted | 250ms | 10756 KiB | ||||
19 | Accepted | 248ms | 11008 KiB | ||||
20 | Accepted | 254ms | 10972 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 125ms | 4316 KiB | ||||
22 | Wrong answer | 146ms | 5828 KiB | ||||
23 | Wrong answer | 127ms | 4376 KiB | ||||
24 | Wrong answer | 146ms | 4848 KiB | ||||
25 | Wrong answer | 134ms | 4368 KiB | ||||
26 | Wrong answer | 199ms | 7568 KiB | ||||
27 | Wrong answer | 243ms | 11092 KiB | ||||
28 | Wrong answer | 244ms | 11140 KiB | ||||
29 | Wrong answer | 245ms | 11136 KiB | ||||
30 | Wrong answer | 217ms | 11524 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4412 KiB | ||||
32 | Accepted | 2ms | 4400 KiB | ||||
33 | Wrong answer | 3ms | 4536 KiB | ||||
34 | Wrong answer | 3ms | 4400 KiB | ||||
35 | Wrong answer | 14ms | 4980 KiB | ||||
36 | Wrong answer | 138ms | 4536 KiB | ||||
37 | Wrong answer | 254ms | 11760 KiB | ||||
38 | Wrong answer | 254ms | 12064 KiB | ||||
39 | Wrong answer | 254ms | 12092 KiB | ||||
40 | Wrong answer | 254ms | 12028 KiB | ||||
41 | Wrong answer | 252ms | 12016 KiB | ||||
42 | Wrong answer | 256ms | 12048 KiB |