10850 | 2024-04-16 17:11:09 | turitamas | Szemetessor | cpp17 | Wrong answer 25/100 | 254ms | 17240 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]]=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 | 1752 KiB | ||||
2 | Accepted | 3ms | 1912 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 3ms | 2124 KiB | ||||
4 | Accepted | 3ms | 2332 KiB | ||||
5 | Accepted | 3ms | 2548 KiB | ||||
6 | Wrong answer | 3ms | 2796 KiB | ||||
7 | Accepted | 3ms | 3000 KiB | ||||
8 | Accepted | 3ms | 3000 KiB | ||||
9 | Wrong answer | 3ms | 3124 KiB | ||||
10 | Accepted | 3ms | 3356 KiB | ||||
11 | Wrong answer | 3ms | 3484 KiB | ||||
subtask3 | 25/25 | ||||||
12 | Accepted | 123ms | 9708 KiB | ||||
13 | Accepted | 123ms | 10040 KiB | ||||
14 | Accepted | 137ms | 9948 KiB | ||||
15 | Accepted | 143ms | 10172 KiB | ||||
16 | Accepted | 155ms | 10368 KiB | ||||
17 | Accepted | 202ms | 13216 KiB | ||||
18 | Accepted | 252ms | 16440 KiB | ||||
19 | Accepted | 252ms | 16324 KiB | ||||
20 | Accepted | 252ms | 16324 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 127ms | 10376 KiB | ||||
22 | Wrong answer | 150ms | 11936 KiB | ||||
23 | Wrong answer | 128ms | 10848 KiB | ||||
24 | Wrong answer | 151ms | 11644 KiB | ||||
25 | Wrong answer | 137ms | 11192 KiB | ||||
26 | Wrong answer | 200ms | 13780 KiB | ||||
27 | Wrong answer | 245ms | 16624 KiB | ||||
28 | Wrong answer | 250ms | 16812 KiB | ||||
29 | Wrong answer | 247ms | 16884 KiB | ||||
30 | Wrong answer | 219ms | 17240 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4664 KiB | ||||
32 | Accepted | 3ms | 4788 KiB | ||||
33 | Wrong answer | 3ms | 4780 KiB | ||||
34 | Wrong answer | 3ms | 4792 KiB | ||||
35 | Wrong answer | 14ms | 5352 KiB | ||||
36 | Wrong answer | 143ms | 10996 KiB | ||||
37 | Wrong answer | 254ms | 17172 KiB | ||||
38 | Wrong answer | 254ms | 17176 KiB | ||||
39 | Wrong answer | 252ms | 17176 KiB | ||||
40 | Wrong answer | 254ms | 17172 KiB | ||||
41 | Wrong answer | 252ms | 17072 KiB | ||||
42 | Wrong answer | 254ms | 17056 KiB |