3524 | 2023-02-28 17:14:46 | Ancsa | Szemetessor | cpp11 | Wrong answer 0/100 | 833ms | 27648 KiB |
#include <bits/stdc++.h>
/*
5 12
66 73 69 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:
*/
using namespace std;
int main()
{
int kszam, napsz;
cin>>kszam>>napsz;
vector<pair<int, int>> szemet(napsz);
vector<int> kapac(kszam);
for(int i=0;i<kszam;i++)
cin>>kapac.at(i);
for(int i=0;i<napsz;i++)
{
cin>>szemet.at(i).first>>szemet.at(i).second;
}
/*
for(int x:kapac)
cout<<x<<" ";
cout<<endl;
*/
for(pair<int,int> par: szemet)
cout<<par.first<<" "<<par.second<<endl;
map<int,int> tarolo;
long long int fizetni=0;
for(pair<int,int> par: szemet)
{
tarolo[par.first]+=par.second;
if (tarolo[par.first]>kapac.at(par.first))
{
tarolo[par.first]-=par.second;
fizetni+=kapac.at(par.first)-tarolo.at(par.first);
tarolo.at(par.first)=par.second;
}
}
/*
cout<<"A map tartalma: \n\n";
for(pair<int,int> elem:tarolo)
cout<<elem.first<<" "<<elem.second<<endl;
*/
for(pair<int,int> elem:tarolo)
{
if(elem.second>0)
fizetni+=kapac.at(elem.first)-tarolo.at(elem.first);
}
cout<<fizetni;
//cout << "Hello world!" << endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1680 KiB | ||||
2 | Wrong answer | 3ms | 1860 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Wrong answer | 3ms | 2236 KiB | ||||
4 | Wrong answer | 3ms | 2452 KiB | ||||
5 | Wrong answer | 3ms | 2632 KiB | ||||
6 | Wrong answer | 3ms | 2848 KiB | ||||
7 | Wrong answer | 3ms | 3056 KiB | ||||
8 | Wrong answer | 3ms | 3296 KiB | ||||
9 | Wrong answer | 3ms | 3268 KiB | ||||
10 | Wrong answer | 3ms | 3412 KiB | ||||
11 | Wrong answer | 3ms | 3516 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 605ms | 6556 KiB | ||||
13 | Wrong answer | 584ms | 7032 KiB | ||||
14 | Wrong answer | 630ms | 6796 KiB | ||||
15 | Wrong answer | 561ms | 7200 KiB | ||||
16 | Wrong answer | 675ms | 7772 KiB | ||||
17 | Wrong answer | 773ms | 16964 KiB | ||||
18 | Wrong answer | 833ms | 27432 KiB | ||||
19 | Wrong answer | 750ms | 27632 KiB | ||||
20 | Wrong answer | 791ms | 27648 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 430ms | 8104 KiB | ||||
22 | Wrong answer | 651ms | 11316 KiB | ||||
23 | Wrong answer | 584ms | 8084 KiB | ||||
24 | Wrong answer | 587ms | 9664 KiB | ||||
25 | Wrong answer | 556ms | 8132 KiB | ||||
26 | Wrong answer | 721ms | 15428 KiB | ||||
27 | Wrong answer | 625ms | 20012 KiB | ||||
28 | Wrong answer | 591ms | 20676 KiB | ||||
29 | Wrong answer | 717ms | 20004 KiB | ||||
30 | Wrong answer | 654ms | 19604 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Wrong answer | 3ms | 4652 KiB | ||||
32 | Wrong answer | 3ms | 4740 KiB | ||||
33 | Wrong answer | 3ms | 4572 KiB | ||||
34 | Wrong answer | 4ms | 4684 KiB | ||||
35 | Wrong answer | 41ms | 4952 KiB | ||||
36 | Wrong answer | 460ms | 7680 KiB | ||||
37 | Wrong answer | 614ms | 14148 KiB | ||||
38 | Wrong answer | 578ms | 13208 KiB | ||||
39 | Wrong answer | 788ms | 15848 KiB | ||||
40 | Wrong answer | 797ms | 18984 KiB | ||||
41 | Wrong answer | 614ms | 21168 KiB | ||||
42 | Wrong answer | 750ms | 20092 KiB |