108472024-04-16 16:35:21turitamasSzemetessorcpp17Wrong answer 25/100254ms17452 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1876 KiB
2Accepted3ms2064 KiB
subtask20/17
3Accepted3ms2284 KiB
4Accepted3ms2492 KiB
5Accepted3ms2732 KiB
6Wrong answer3ms2948 KiB
7Accepted3ms3128 KiB
8Accepted3ms3372 KiB
9Wrong answer3ms3584 KiB
10Accepted3ms3724 KiB
11Wrong answer3ms3800 KiB
subtask325/25
12Accepted123ms10080 KiB
13Accepted123ms10024 KiB
14Accepted137ms10032 KiB
15Accepted143ms10300 KiB
16Accepted155ms10520 KiB
17Accepted202ms13328 KiB
18Accepted252ms16460 KiB
19Accepted252ms16408 KiB
20Accepted254ms16664 KiB
subtask40/20
21Wrong answer128ms10784 KiB
22Wrong answer151ms11956 KiB
23Wrong answer129ms11084 KiB
24Wrong answer153ms11344 KiB
25Wrong answer137ms10804 KiB
26Wrong answer202ms13740 KiB
27Wrong answer246ms16492 KiB
28Wrong answer248ms16836 KiB
29Wrong answer248ms16916 KiB
30Wrong answer218ms16972 KiB
subtask50/38
31Accepted3ms4584 KiB
32Accepted3ms4704 KiB
33Wrong answer3ms4696 KiB
34Wrong answer3ms4828 KiB
35Wrong answer14ms5472 KiB
36Wrong answer143ms11068 KiB
37Wrong answer254ms17232 KiB
38Wrong answer252ms17228 KiB
39Wrong answer252ms17440 KiB
40Wrong answer254ms17452 KiB
41Wrong answer252ms17408 KiB
42Wrong answer254ms17396 KiB