10848 | 2024-04-16 16:50:50 | turitamas | Szemetessor | cpp17 | Wrong answer 25/100 | 261ms | 17624 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
{
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 | 2120 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 2ms | 2204 KiB | ||||
4 | Accepted | 3ms | 2284 KiB | ||||
5 | Accepted | 3ms | 2496 KiB | ||||
6 | Wrong answer | 3ms | 2632 KiB | ||||
7 | Accepted | 3ms | 2804 KiB | ||||
8 | Accepted | 3ms | 3044 KiB | ||||
9 | Wrong answer | 3ms | 3136 KiB | ||||
10 | Accepted | 3ms | 3256 KiB | ||||
11 | Wrong answer | 3ms | 3476 KiB | ||||
subtask3 | 25/25 | ||||||
12 | Accepted | 123ms | 10044 KiB | ||||
13 | Accepted | 123ms | 10032 KiB | ||||
14 | Accepted | 149ms | 10092 KiB | ||||
15 | Accepted | 143ms | 10280 KiB | ||||
16 | Accepted | 155ms | 10544 KiB | ||||
17 | Accepted | 202ms | 13580 KiB | ||||
18 | Accepted | 256ms | 16600 KiB | ||||
19 | Accepted | 252ms | 16860 KiB | ||||
20 | Accepted | 252ms | 16868 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 128ms | 11108 KiB | ||||
22 | Wrong answer | 158ms | 12584 KiB | ||||
23 | Wrong answer | 129ms | 11360 KiB | ||||
24 | Wrong answer | 153ms | 11792 KiB | ||||
25 | Wrong answer | 137ms | 11360 KiB | ||||
26 | Wrong answer | 201ms | 14428 KiB | ||||
27 | Wrong answer | 246ms | 17320 KiB | ||||
28 | Wrong answer | 250ms | 17388 KiB | ||||
29 | Wrong answer | 248ms | 17384 KiB | ||||
30 | Wrong answer | 218ms | 17532 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 5288 KiB | ||||
32 | Wrong answer | 3ms | 5264 KiB | ||||
33 | Wrong answer | 3ms | 5136 KiB | ||||
34 | Wrong answer | 3ms | 5136 KiB | ||||
35 | Wrong answer | 14ms | 5764 KiB | ||||
36 | Wrong answer | 143ms | 11352 KiB | ||||
37 | Wrong answer | 256ms | 17532 KiB | ||||
38 | Wrong answer | 252ms | 17532 KiB | ||||
39 | Wrong answer | 252ms | 17468 KiB | ||||
40 | Wrong answer | 254ms | 17476 KiB | ||||
41 | Wrong answer | 261ms | 17624 KiB | ||||
42 | Wrong answer | 252ms | 17596 KiB |