3517 | 2023-02-28 16:17:16 | Tina0731 | Szemetessor | cpp11 | Wrong answer 17/100 | 248ms | 11164 KiB |
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin>>n>>k;
int c[n];
for(int i=0;i<n;i++)
{
cin>>c[i];
//cout<<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 | 1876 KiB | ||||
2 | Accepted | 3ms | 2120 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2480 KiB | ||||
4 | Accepted | 2ms | 2416 KiB | ||||
5 | Accepted | 3ms | 2756 KiB | ||||
6 | Accepted | 2ms | 2692 KiB | ||||
7 | Accepted | 3ms | 2820 KiB | ||||
8 | Accepted | 3ms | 3068 KiB | ||||
9 | Accepted | 2ms | 3156 KiB | ||||
10 | Accepted | 3ms | 3368 KiB | ||||
11 | Accepted | 3ms | 3360 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 123ms | 6732 KiB | ||||
13 | Wrong answer | 120ms | 6780 KiB | ||||
14 | Wrong answer | 134ms | 6776 KiB | ||||
15 | Wrong answer | 138ms | 6936 KiB | ||||
16 | Wrong answer | 150ms | 6988 KiB | ||||
17 | Wrong answer | 197ms | 8476 KiB | ||||
18 | Wrong answer | 247ms | 10352 KiB | ||||
19 | Wrong answer | 246ms | 10280 KiB | ||||
20 | Wrong answer | 246ms | 10280 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 125ms | 7260 KiB | ||||
22 | Wrong answer | 145ms | 7752 KiB | ||||
23 | Accepted | 128ms | 7316 KiB | ||||
24 | Wrong answer | 146ms | 7520 KiB | ||||
25 | Accepted | 134ms | 7268 KiB | ||||
26 | Wrong answer | 194ms | 8740 KiB | ||||
27 | Wrong answer | 239ms | 10164 KiB | ||||
28 | Wrong answer | 241ms | 10332 KiB | ||||
29 | Wrong answer | 244ms | 10460 KiB | ||||
30 | Wrong answer | 210ms | 10496 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4436 KiB | ||||
32 | Accepted | 3ms | 4556 KiB | ||||
33 | Accepted | 3ms | 4528 KiB | ||||
34 | Accepted | 3ms | 4532 KiB | ||||
35 | Wrong answer | 14ms | 4924 KiB | ||||
36 | Wrong answer | 141ms | 7628 KiB | ||||
37 | Wrong answer | 246ms | 10784 KiB | ||||
38 | Wrong answer | 246ms | 10864 KiB | ||||
39 | Wrong answer | 248ms | 10908 KiB | ||||
40 | Wrong answer | 247ms | 11164 KiB | ||||
41 | Wrong answer | 246ms | 10996 KiB | ||||
42 | Wrong answer | 247ms | 10996 KiB |