10847 | 2024-04-16 16:35:21 | turitamas | Szemetessor | cpp17 | Wrong answer 25/100 | 254ms | 17452 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 | 2064 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 3ms | 2284 KiB | ||||
4 | Accepted | 3ms | 2492 KiB | ||||
5 | Accepted | 3ms | 2732 KiB | ||||
6 | Wrong answer | 3ms | 2948 KiB | ||||
7 | Accepted | 3ms | 3128 KiB | ||||
8 | Accepted | 3ms | 3372 KiB | ||||
9 | Wrong answer | 3ms | 3584 KiB | ||||
10 | Accepted | 3ms | 3724 KiB | ||||
11 | Wrong answer | 3ms | 3800 KiB | ||||
subtask3 | 25/25 | ||||||
12 | Accepted | 123ms | 10080 KiB | ||||
13 | Accepted | 123ms | 10024 KiB | ||||
14 | Accepted | 137ms | 10032 KiB | ||||
15 | Accepted | 143ms | 10300 KiB | ||||
16 | Accepted | 155ms | 10520 KiB | ||||
17 | Accepted | 202ms | 13328 KiB | ||||
18 | Accepted | 252ms | 16460 KiB | ||||
19 | Accepted | 252ms | 16408 KiB | ||||
20 | Accepted | 254ms | 16664 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 128ms | 10784 KiB | ||||
22 | Wrong answer | 151ms | 11956 KiB | ||||
23 | Wrong answer | 129ms | 11084 KiB | ||||
24 | Wrong answer | 153ms | 11344 KiB | ||||
25 | Wrong answer | 137ms | 10804 KiB | ||||
26 | Wrong answer | 202ms | 13740 KiB | ||||
27 | Wrong answer | 246ms | 16492 KiB | ||||
28 | Wrong answer | 248ms | 16836 KiB | ||||
29 | Wrong answer | 248ms | 16916 KiB | ||||
30 | Wrong answer | 218ms | 16972 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4584 KiB | ||||
32 | Accepted | 3ms | 4704 KiB | ||||
33 | Wrong answer | 3ms | 4696 KiB | ||||
34 | Wrong answer | 3ms | 4828 KiB | ||||
35 | Wrong answer | 14ms | 5472 KiB | ||||
36 | Wrong answer | 143ms | 11068 KiB | ||||
37 | Wrong answer | 254ms | 17232 KiB | ||||
38 | Wrong answer | 252ms | 17228 KiB | ||||
39 | Wrong answer | 252ms | 17440 KiB | ||||
40 | Wrong answer | 254ms | 17452 KiB | ||||
41 | Wrong answer | 252ms | 17408 KiB | ||||
42 | Wrong answer | 254ms | 17396 KiB |