34492023-02-28 09:07:10AncsaSzemetessorcpp11Wrong answer 17/100518ms25268 KiB
#include <bits/stdc++.h>

using namespace std;

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

kimenet: 7
*/

/*
5 12
66 73 68 79 78
2 50
3 69
0 1
0 12
2 20
0 23
1 44
1 30
4 12
4 3
4 63
0 10

kimenet> 168
*/

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;

    for(int i=0;i<n;i++)
    {
        kukak[i]=kapacitas.at(i);
    }


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

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

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

    for(pair<int,int> x : kukak)
    {
        if (x.second!=kapacitas.at(x.first))
        {
            fizetni+=x.second;
        }
    }
    cout<<fizetni;
    //cout << "Hello world!" << endl;*/
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1680 KiB
2Accepted3ms1848 KiB
subtask217/17
3Accepted3ms2092 KiB
4Accepted3ms2308 KiB
5Accepted3ms2512 KiB
6Accepted3ms2752 KiB
7Accepted3ms2972 KiB
8Accepted3ms3280 KiB
9Accepted3ms3236 KiB
10Accepted3ms3452 KiB
11Accepted3ms3412 KiB
subtask30/25
12Wrong answer136ms3540 KiB
13Wrong answer173ms4068 KiB
14Wrong answer201ms4056 KiB
15Wrong answer219ms4224 KiB
16Wrong answer256ms5112 KiB
17Wrong answer372ms13832 KiB
18Wrong answer448ms24196 KiB
19Wrong answer451ms24324 KiB
20Wrong answer453ms24256 KiB
subtask40/20
21Accepted186ms5100 KiB
22Wrong answer247ms9176 KiB
23Accepted188ms5300 KiB
24Wrong answer225ms6824 KiB
25Accepted195ms5428 KiB
26Wrong answer331ms14452 KiB
27Wrong answer460ms23820 KiB
28Wrong answer437ms24280 KiB
29Wrong answer455ms24276 KiB
30Wrong answer418ms24796 KiB
subtask50/38
31Accepted3ms4644 KiB
32Accepted3ms4768 KiB
33Accepted3ms4728 KiB
34Accepted3ms4836 KiB
35Wrong answer20ms5620 KiB
36Wrong answer203ms4652 KiB
37Wrong answer509ms24948 KiB
38Wrong answer518ms24800 KiB
39Wrong answer505ms24800 KiB
40Wrong answer493ms24800 KiB
41Wrong answer472ms25056 KiB
42Wrong answer476ms25268 KiB