34462023-02-28 07:38:19AncsaSzemetessorcpp11Wrong answer 17/100419ms24360 KiB
#include <bits/stdc++.h>

using namespace std;

/*
2 3
5 7
0 4
1 1
1 7

kimenet: 7
*/

/*
5 7
66 73 68 79 78
2 50
3 69
0 1
2 20
4 12
1 44
3 11

kimenet: 304
*/

void mapkiir(map<int,int> a)
{
    cout<<"*******\n";
    for(pair<int,int> x : a)
        cout<<x.first<<"\t"<<x.second<<endl;

    cout <<"+++++++++\n";
}


int main()
{
    int n,k;
    cin>>n>>k;
    vector<int> kapacitas(n);
    for(int i=0;i<n;i++)
        cin>>kapacitas.at(i);


    pair <int, int> nap;
    map <int,int> kukak;


    int fizetni=0;
    for(int i=0;i<k;i++)
    {
        cin>>nap.first>>nap.second;
        kukak[nap.first]+=nap.second;

        if(kukak[nap.first]>=kapacitas.at(nap.first))
        {
            kukak[nap.first]-=nap.second;
            int fizetmost=kapacitas.at(nap.first)-kukak[nap.first];
            //cout<<i<<" nap"<<nap.first<<" sorszamu kukaert fizet "<<fizetmost<<" penzt. "<<endl;

            kukak[nap.first]=nap.second;
            fizetni+=fizetmost;
        }
        //mapkiir(kukak);
    }

    for(pair<int,int> x : kukak)
    {
        if (x.second!=0)
        {
            fizetni+=kapacitas.at(x.first)-x.second;
        }
    }
    cout<<fizetni;
    //cout << "Hello world!" << endl;*/
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted3ms2060 KiB
subtask217/17
3Accepted3ms2232 KiB
4Accepted3ms2348 KiB
5Accepted3ms2468 KiB
6Accepted3ms2596 KiB
7Accepted3ms2820 KiB
8Accepted3ms2944 KiB
9Accepted3ms3044 KiB
10Accepted3ms3228 KiB
11Accepted3ms3472 KiB
subtask30/25
12Wrong answer135ms3564 KiB
13Wrong answer171ms3580 KiB
14Wrong answer199ms3948 KiB
15Wrong answer218ms4260 KiB
16Wrong answer241ms5164 KiB
17Wrong answer321ms14056 KiB
18Wrong answer388ms24360 KiB
19Wrong answer388ms24356 KiB
20Wrong answer386ms24360 KiB
subtask40/20
21Wrong answer177ms4824 KiB
22Wrong answer224ms8112 KiB
23Wrong answer179ms5140 KiB
24Wrong answer215ms6752 KiB
25Wrong answer186ms5236 KiB
26Wrong answer287ms12532 KiB
27Wrong answer347ms16768 KiB
28Wrong answer351ms17284 KiB
29Wrong answer349ms17024 KiB
30Wrong answer314ms16464 KiB
subtask50/38
31Accepted3ms4580 KiB
32Wrong answer3ms4584 KiB
33Accepted3ms4700 KiB
34Accepted3ms4700 KiB
35Wrong answer17ms4752 KiB
36Wrong answer193ms4608 KiB
37Wrong answer368ms10620 KiB
38Wrong answer370ms9704 KiB
39Wrong answer386ms12272 KiB
40Wrong answer384ms15488 KiB
41Wrong answer419ms17588 KiB
42Wrong answer393ms16548 KiB