108482024-04-16 16:50:50turitamasSzemetessorcpp17Wrong answer 25/100261ms17624 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
2Accepted3ms2120 KiB
subtask20/17
3Accepted2ms2204 KiB
4Accepted3ms2284 KiB
5Accepted3ms2496 KiB
6Wrong answer3ms2632 KiB
7Accepted3ms2804 KiB
8Accepted3ms3044 KiB
9Wrong answer3ms3136 KiB
10Accepted3ms3256 KiB
11Wrong answer3ms3476 KiB
subtask325/25
12Accepted123ms10044 KiB
13Accepted123ms10032 KiB
14Accepted149ms10092 KiB
15Accepted143ms10280 KiB
16Accepted155ms10544 KiB
17Accepted202ms13580 KiB
18Accepted256ms16600 KiB
19Accepted252ms16860 KiB
20Accepted252ms16868 KiB
subtask40/20
21Wrong answer128ms11108 KiB
22Wrong answer158ms12584 KiB
23Wrong answer129ms11360 KiB
24Wrong answer153ms11792 KiB
25Wrong answer137ms11360 KiB
26Wrong answer201ms14428 KiB
27Wrong answer246ms17320 KiB
28Wrong answer250ms17388 KiB
29Wrong answer248ms17384 KiB
30Wrong answer218ms17532 KiB
subtask50/38
31Accepted3ms5288 KiB
32Wrong answer3ms5264 KiB
33Wrong answer3ms5136 KiB
34Wrong answer3ms5136 KiB
35Wrong answer14ms5764 KiB
36Wrong answer143ms11352 KiB
37Wrong answer256ms17532 KiB
38Wrong answer252ms17532 KiB
39Wrong answer252ms17468 KiB
40Wrong answer254ms17476 KiB
41Wrong answer261ms17624 KiB
42Wrong answer252ms17596 KiB