10849 | 2024-04-16 16:53:46 | turitamas | Szemetessor | cpp17 | Wrong answer 25/100 | 256ms | 16712 KiB |
#include <iostream>
using namespace std;
int main()
{
int n, k;
cin>>n>>k;
long long int c[n]={0};
long long int m[n]={0};
long long int t[k][2];
long long int a=0;
for(int i=0; i<n; i++)
{
cin>>c[i];
}
for(int i=0; i<k; i++)
{
for(int j=0; j<2; j++)
{
cin>>t[i][j];
}
}
for(int i=0; i<k; i++)
{
if(c[t[i][0]]>=t[i][1]+m[t[i][0]])
{
m[t[i][0]]+=t[i][1];
}
else if(c[t[i][0]]<t[i][1]+m[t[i][0]])
{
a+=c[t[i][0]]-m[t[i][0]];
m[t[i][0]]=0;
m[t[i][0]]+=t[i][1];
}
}
for(int i=0; i<n; i++)
{
a+=c[i]-m[i];
}
cout<<a;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1876 KiB | ||||
2 | Accepted | 3ms | 2268 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 3ms | 2400 KiB | ||||
4 | Accepted | 3ms | 2652 KiB | ||||
5 | Accepted | 3ms | 2736 KiB | ||||
6 | Wrong answer | 3ms | 2928 KiB | ||||
7 | Accepted | 3ms | 2952 KiB | ||||
8 | Accepted | 3ms | 3016 KiB | ||||
9 | Wrong answer | 3ms | 3268 KiB | ||||
10 | Accepted | 3ms | 3244 KiB | ||||
11 | Wrong answer | 3ms | 3212 KiB | ||||
subtask3 | 25/25 | ||||||
12 | Accepted | 123ms | 9408 KiB | ||||
13 | Accepted | 123ms | 9420 KiB | ||||
14 | Accepted | 137ms | 9684 KiB | ||||
15 | Accepted | 144ms | 9936 KiB | ||||
16 | Accepted | 156ms | 10104 KiB | ||||
17 | Accepted | 206ms | 12928 KiB | ||||
18 | Accepted | 254ms | 16344 KiB | ||||
19 | Accepted | 252ms | 16288 KiB | ||||
20 | Accepted | 254ms | 16436 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 128ms | 10296 KiB | ||||
22 | Wrong answer | 151ms | 11536 KiB | ||||
23 | Wrong answer | 130ms | 10356 KiB | ||||
24 | Wrong answer | 151ms | 10892 KiB | ||||
25 | Wrong answer | 137ms | 10540 KiB | ||||
26 | Wrong answer | 201ms | 13396 KiB | ||||
27 | Wrong answer | 250ms | 16168 KiB | ||||
28 | Wrong answer | 247ms | 16424 KiB | ||||
29 | Wrong answer | 254ms | 16384 KiB | ||||
30 | Wrong answer | 218ms | 16600 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4088 KiB | ||||
32 | Accepted | 3ms | 4088 KiB | ||||
33 | Wrong answer | 3ms | 4176 KiB | ||||
34 | Wrong answer | 3ms | 4068 KiB | ||||
35 | Wrong answer | 14ms | 4740 KiB | ||||
36 | Wrong answer | 150ms | 10276 KiB | ||||
37 | Wrong answer | 256ms | 16652 KiB | ||||
38 | Wrong answer | 254ms | 16480 KiB | ||||
39 | Wrong answer | 252ms | 16628 KiB | ||||
40 | Wrong answer | 254ms | 16608 KiB | ||||
41 | Wrong answer | 252ms | 16584 KiB | ||||
42 | Wrong answer | 252ms | 16712 KiB |