10844 | 2024-04-16 16:16:57 | TheViktor | Szemetessor | cpp17 | Wrong answer 17/100 | 261ms | 10788 KiB |
#include <iostream>
using namespace std;
int main()
{
int n, k;
cin>>n>>k;
int c[n];
for(int i=0;i<n;i++)
{
cin>>c[i];
}
int nap[k][2];
for(int j=0;j<k; j++)
cin>>nap[j][0]>>nap[j][1];
int ar=0;
int sz[n];
for(int i=0;i<n;i++)
sz[i]=0;
int i, x;
for(int j=0;j<k; j++)
{
i=nap[j][0];
x=nap[j][1];
if(sz[i]+x<=c[i])
sz[i]+=x;
else
{
ar=ar+c[i]-sz[i];
sz[i]=x;
}
}
for(i=0;i<n;i++)
{
if(sz[i]!=0)
ar=ar+c[i]-sz[i];
}
cout<<ar;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1748 KiB | ||||
2 | Accepted | 3ms | 1908 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2120 KiB | ||||
4 | Accepted | 3ms | 2336 KiB | ||||
5 | Accepted | 3ms | 2548 KiB | ||||
6 | Accepted | 2ms | 2668 KiB | ||||
7 | Accepted | 3ms | 2904 KiB | ||||
8 | Accepted | 2ms | 2876 KiB | ||||
9 | Accepted | 2ms | 2872 KiB | ||||
10 | Accepted | 3ms | 2820 KiB | ||||
11 | Accepted | 2ms | 2944 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 126ms | 6168 KiB | ||||
13 | Wrong answer | 126ms | 6256 KiB | ||||
14 | Wrong answer | 141ms | 6536 KiB | ||||
15 | Wrong answer | 145ms | 6280 KiB | ||||
16 | Wrong answer | 160ms | 6220 KiB | ||||
17 | Wrong answer | 209ms | 7964 KiB | ||||
18 | Wrong answer | 257ms | 9572 KiB | ||||
19 | Wrong answer | 259ms | 9572 KiB | ||||
20 | Wrong answer | 256ms | 9640 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 130ms | 6556 KiB | ||||
22 | Wrong answer | 155ms | 7276 KiB | ||||
23 | Accepted | 130ms | 6536 KiB | ||||
24 | Wrong answer | 155ms | 7048 KiB | ||||
25 | Accepted | 141ms | 6820 KiB | ||||
26 | Wrong answer | 204ms | 8220 KiB | ||||
27 | Wrong answer | 252ms | 9564 KiB | ||||
28 | Wrong answer | 254ms | 9632 KiB | ||||
29 | Wrong answer | 256ms | 9632 KiB | ||||
30 | Wrong answer | 222ms | 9668 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 3652 KiB | ||||
32 | Accepted | 3ms | 3716 KiB | ||||
33 | Accepted | 3ms | 3716 KiB | ||||
34 | Accepted | 3ms | 3964 KiB | ||||
35 | Wrong answer | 14ms | 4212 KiB | ||||
36 | Wrong answer | 146ms | 7000 KiB | ||||
37 | Wrong answer | 259ms | 10092 KiB | ||||
38 | Wrong answer | 261ms | 10412 KiB | ||||
39 | Wrong answer | 261ms | 10408 KiB | ||||
40 | Wrong answer | 261ms | 10716 KiB | ||||
41 | Wrong answer | 259ms | 10788 KiB | ||||
42 | Wrong answer | 261ms | 10728 KiB |