35172023-02-28 16:17:16Tina0731Szemetessorcpp11Wrong answer 17/100248ms11164 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1876 KiB
2Accepted3ms2120 KiB
subtask217/17
3Accepted3ms2480 KiB
4Accepted2ms2416 KiB
5Accepted3ms2756 KiB
6Accepted2ms2692 KiB
7Accepted3ms2820 KiB
8Accepted3ms3068 KiB
9Accepted2ms3156 KiB
10Accepted3ms3368 KiB
11Accepted3ms3360 KiB
subtask30/25
12Wrong answer123ms6732 KiB
13Wrong answer120ms6780 KiB
14Wrong answer134ms6776 KiB
15Wrong answer138ms6936 KiB
16Wrong answer150ms6988 KiB
17Wrong answer197ms8476 KiB
18Wrong answer247ms10352 KiB
19Wrong answer246ms10280 KiB
20Wrong answer246ms10280 KiB
subtask40/20
21Accepted125ms7260 KiB
22Wrong answer145ms7752 KiB
23Accepted128ms7316 KiB
24Wrong answer146ms7520 KiB
25Accepted134ms7268 KiB
26Wrong answer194ms8740 KiB
27Wrong answer239ms10164 KiB
28Wrong answer241ms10332 KiB
29Wrong answer244ms10460 KiB
30Wrong answer210ms10496 KiB
subtask50/38
31Accepted3ms4436 KiB
32Accepted3ms4556 KiB
33Accepted3ms4528 KiB
34Accepted3ms4532 KiB
35Wrong answer14ms4924 KiB
36Wrong answer141ms7628 KiB
37Wrong answer246ms10784 KiB
38Wrong answer246ms10864 KiB
39Wrong answer248ms10908 KiB
40Wrong answer247ms11164 KiB
41Wrong answer246ms10996 KiB
42Wrong answer247ms10996 KiB