108492024-04-16 16:53:46turitamasSzemetessorcpp17Wrong answer 25/100256ms16712 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 if(c[t[i][0]]<t[i][1]+m[t[i][0]])
        {
            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
2Accepted3ms2268 KiB
subtask20/17
3Accepted3ms2400 KiB
4Accepted3ms2652 KiB
5Accepted3ms2736 KiB
6Wrong answer3ms2928 KiB
7Accepted3ms2952 KiB
8Accepted3ms3016 KiB
9Wrong answer3ms3268 KiB
10Accepted3ms3244 KiB
11Wrong answer3ms3212 KiB
subtask325/25
12Accepted123ms9408 KiB
13Accepted123ms9420 KiB
14Accepted137ms9684 KiB
15Accepted144ms9936 KiB
16Accepted156ms10104 KiB
17Accepted206ms12928 KiB
18Accepted254ms16344 KiB
19Accepted252ms16288 KiB
20Accepted254ms16436 KiB
subtask40/20
21Wrong answer128ms10296 KiB
22Wrong answer151ms11536 KiB
23Wrong answer130ms10356 KiB
24Wrong answer151ms10892 KiB
25Wrong answer137ms10540 KiB
26Wrong answer201ms13396 KiB
27Wrong answer250ms16168 KiB
28Wrong answer247ms16424 KiB
29Wrong answer254ms16384 KiB
30Wrong answer218ms16600 KiB
subtask50/38
31Accepted3ms4088 KiB
32Accepted3ms4088 KiB
33Wrong answer3ms4176 KiB
34Wrong answer3ms4068 KiB
35Wrong answer14ms4740 KiB
36Wrong answer150ms10276 KiB
37Wrong answer256ms16652 KiB
38Wrong answer254ms16480 KiB
39Wrong answer252ms16628 KiB
40Wrong answer254ms16608 KiB
41Wrong answer252ms16584 KiB
42Wrong answer252ms16712 KiB