10846 | 2024-04-16 16:33:36 | turitamas | Szemetessor | cpp17 | Wrong answer 0/100 | 244ms | 10224 KiB |
#include <iostream>
using namespace std;
int main()
{
int n, k;
cin>>n>>k;
int c[n]={0};
int m[n]={0};
int t[k][2];
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 | 1912 KiB | ||||
2 | Accepted | 3ms | 2216 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 3ms | 2356 KiB | ||||
4 | Accepted | 3ms | 2496 KiB | ||||
5 | Accepted | 3ms | 2636 KiB | ||||
6 | Wrong answer | 3ms | 2852 KiB | ||||
7 | Accepted | 3ms | 2968 KiB | ||||
8 | Accepted | 3ms | 2964 KiB | ||||
9 | Wrong answer | 3ms | 3096 KiB | ||||
10 | Accepted | 3ms | 3088 KiB | ||||
11 | Wrong answer | 3ms | 3056 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 126ms | 6280 KiB | ||||
13 | Wrong answer | 119ms | 6376 KiB | ||||
14 | Wrong answer | 133ms | 6336 KiB | ||||
15 | Wrong answer | 137ms | 6344 KiB | ||||
16 | Wrong answer | 149ms | 6328 KiB | ||||
17 | Wrong answer | 194ms | 7816 KiB | ||||
18 | Wrong answer | 240ms | 9412 KiB | ||||
19 | Wrong answer | 240ms | 9668 KiB | ||||
20 | Wrong answer | 240ms | 9624 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 123ms | 6924 KiB | ||||
22 | Wrong answer | 144ms | 7632 KiB | ||||
23 | Wrong answer | 126ms | 6816 KiB | ||||
24 | Wrong answer | 145ms | 7072 KiB | ||||
25 | Wrong answer | 133ms | 6816 KiB | ||||
26 | Wrong answer | 193ms | 8292 KiB | ||||
27 | Wrong answer | 234ms | 9628 KiB | ||||
28 | Wrong answer | 236ms | 9808 KiB | ||||
29 | Wrong answer | 237ms | 9800 KiB | ||||
30 | Wrong answer | 208ms | 9832 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 3644 KiB | ||||
32 | Accepted | 3ms | 3644 KiB | ||||
33 | Wrong answer | 3ms | 3644 KiB | ||||
34 | Wrong answer | 3ms | 3656 KiB | ||||
35 | Wrong answer | 14ms | 3940 KiB | ||||
36 | Wrong answer | 137ms | 6844 KiB | ||||
37 | Wrong answer | 241ms | 9856 KiB | ||||
38 | Wrong answer | 241ms | 10000 KiB | ||||
39 | Wrong answer | 241ms | 10160 KiB | ||||
40 | Wrong answer | 240ms | 10224 KiB | ||||
41 | Wrong answer | 244ms | 10116 KiB | ||||
42 | Wrong answer | 243ms | 10064 KiB |