3446 | 2023-02-28 07:38:19 | Ancsa | Szemetessor | cpp11 | Wrong answer 17/100 | 419ms | 24360 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2060 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2232 KiB | ||||
4 | Accepted | 3ms | 2348 KiB | ||||
5 | Accepted | 3ms | 2468 KiB | ||||
6 | Accepted | 3ms | 2596 KiB | ||||
7 | Accepted | 3ms | 2820 KiB | ||||
8 | Accepted | 3ms | 2944 KiB | ||||
9 | Accepted | 3ms | 3044 KiB | ||||
10 | Accepted | 3ms | 3228 KiB | ||||
11 | Accepted | 3ms | 3472 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 135ms | 3564 KiB | ||||
13 | Wrong answer | 171ms | 3580 KiB | ||||
14 | Wrong answer | 199ms | 3948 KiB | ||||
15 | Wrong answer | 218ms | 4260 KiB | ||||
16 | Wrong answer | 241ms | 5164 KiB | ||||
17 | Wrong answer | 321ms | 14056 KiB | ||||
18 | Wrong answer | 388ms | 24360 KiB | ||||
19 | Wrong answer | 388ms | 24356 KiB | ||||
20 | Wrong answer | 386ms | 24360 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 177ms | 4824 KiB | ||||
22 | Wrong answer | 224ms | 8112 KiB | ||||
23 | Wrong answer | 179ms | 5140 KiB | ||||
24 | Wrong answer | 215ms | 6752 KiB | ||||
25 | Wrong answer | 186ms | 5236 KiB | ||||
26 | Wrong answer | 287ms | 12532 KiB | ||||
27 | Wrong answer | 347ms | 16768 KiB | ||||
28 | Wrong answer | 351ms | 17284 KiB | ||||
29 | Wrong answer | 349ms | 17024 KiB | ||||
30 | Wrong answer | 314ms | 16464 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4580 KiB | ||||
32 | Wrong answer | 3ms | 4584 KiB | ||||
33 | Accepted | 3ms | 4700 KiB | ||||
34 | Accepted | 3ms | 4700 KiB | ||||
35 | Wrong answer | 17ms | 4752 KiB | ||||
36 | Wrong answer | 193ms | 4608 KiB | ||||
37 | Wrong answer | 368ms | 10620 KiB | ||||
38 | Wrong answer | 370ms | 9704 KiB | ||||
39 | Wrong answer | 386ms | 12272 KiB | ||||
40 | Wrong answer | 384ms | 15488 KiB | ||||
41 | Wrong answer | 419ms | 17588 KiB | ||||
42 | Wrong answer | 393ms | 16548 KiB |