108502024-04-16 17:11:09turitamasSzemetessorcpp17Wrong answer 25/100254ms17240 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]]=t[i][1];
        }
    }
    for(int i=0; i<n; i++)
    {
        a+=(c[i]-m[i]);
    }

    cout<<a;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1752 KiB
2Accepted3ms1912 KiB
subtask20/17
3Accepted3ms2124 KiB
4Accepted3ms2332 KiB
5Accepted3ms2548 KiB
6Wrong answer3ms2796 KiB
7Accepted3ms3000 KiB
8Accepted3ms3000 KiB
9Wrong answer3ms3124 KiB
10Accepted3ms3356 KiB
11Wrong answer3ms3484 KiB
subtask325/25
12Accepted123ms9708 KiB
13Accepted123ms10040 KiB
14Accepted137ms9948 KiB
15Accepted143ms10172 KiB
16Accepted155ms10368 KiB
17Accepted202ms13216 KiB
18Accepted252ms16440 KiB
19Accepted252ms16324 KiB
20Accepted252ms16324 KiB
subtask40/20
21Wrong answer127ms10376 KiB
22Wrong answer150ms11936 KiB
23Wrong answer128ms10848 KiB
24Wrong answer151ms11644 KiB
25Wrong answer137ms11192 KiB
26Wrong answer200ms13780 KiB
27Wrong answer245ms16624 KiB
28Wrong answer250ms16812 KiB
29Wrong answer247ms16884 KiB
30Wrong answer219ms17240 KiB
subtask50/38
31Accepted3ms4664 KiB
32Accepted3ms4788 KiB
33Wrong answer3ms4780 KiB
34Wrong answer3ms4792 KiB
35Wrong answer14ms5352 KiB
36Wrong answer143ms10996 KiB
37Wrong answer254ms17172 KiB
38Wrong answer254ms17176 KiB
39Wrong answer252ms17176 KiB
40Wrong answer254ms17172 KiB
41Wrong answer252ms17072 KiB
42Wrong answer254ms17056 KiB