3520 | 2023-02-28 16:50:25 | Tina0731 | Szemetessor | cpp11 | Wrong answer 0/100 | 437ms | 38244 KiB |
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
/*
5 12
33 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
*/
int main()
{
long long int n, k;
cin>>n>>k;
vector<pair<long long int, long long int>> szemet(k);
vector<long long int> kapac(n);
for(int i=0;i<n;i++)
cin>>kapac.at(i);
for(int i=0;i<k;i++)
cin>>szemet.at(i).first>>szemet.at(i).second;
/*for(int x:kapac)
cout<<x<<" ";*/
cout<<endl;
/*for(pair<int, int> x : szemet)
cout<<x.first<<" "<<x.second<<endl;*/
map<long long int, long long int> tarolo;
//cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<endl;
int moneymoney=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;
moneymoney+=kapac.at(par.first)-tarolo.at(par.first);
tarolo.at(par.first)=par.second;
}
}
/*for(pair<int, int> elem:tarolo )
cout<<elem.first<<" "<<elem.second<<endl;*/
for(pair<int, int> par:tarolo)
{
if(par.second>0)
moneymoney+=kapac.at(par.first)-tarolo.at(par.first);
}
cout<<moneymoney;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1812 KiB | ||||
2 | Wrong answer | 3ms | 2056 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Wrong answer | 3ms | 2300 KiB | ||||
4 | Wrong answer | 2ms | 2352 KiB | ||||
5 | Wrong answer | 3ms | 2492 KiB | ||||
6 | Wrong answer | 3ms | 2816 KiB | ||||
7 | Wrong answer | 3ms | 2916 KiB | ||||
8 | Wrong answer | 3ms | 2996 KiB | ||||
9 | Wrong answer | 3ms | 3124 KiB | ||||
10 | Wrong answer | 3ms | 3184 KiB | ||||
11 | Wrong answer | 3ms | 3256 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 136ms | 9540 KiB | ||||
13 | Wrong answer | 175ms | 9832 KiB | ||||
14 | Wrong answer | 202ms | 10048 KiB | ||||
15 | Wrong answer | 221ms | 10532 KiB | ||||
16 | Wrong answer | 246ms | 11816 KiB | ||||
17 | Wrong answer | 335ms | 24304 KiB | ||||
18 | Wrong answer | 437ms | 38244 KiB | ||||
19 | Wrong answer | 433ms | 38208 KiB | ||||
20 | Wrong answer | 423ms | 38224 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Wrong answer | 180ms | 11224 KiB | ||||
22 | Wrong answer | 231ms | 16264 KiB | ||||
23 | Wrong answer | 186ms | 11716 KiB | ||||
24 | Wrong answer | 219ms | 13648 KiB | ||||
25 | Wrong answer | 190ms | 11572 KiB | ||||
26 | Wrong answer | 300ms | 21972 KiB | ||||
27 | Wrong answer | 367ms | 28464 KiB | ||||
28 | Wrong answer | 393ms | 28860 KiB | ||||
29 | Wrong answer | 391ms | 28232 KiB | ||||
30 | Wrong answer | 351ms | 27448 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Wrong answer | 3ms | 4368 KiB | ||||
32 | Wrong answer | 3ms | 4492 KiB | ||||
33 | Wrong answer | 3ms | 4496 KiB | ||||
34 | Wrong answer | 3ms | 4384 KiB | ||||
35 | Wrong answer | 17ms | 4724 KiB | ||||
36 | Wrong answer | 196ms | 10400 KiB | ||||
37 | Wrong answer | 384ms | 19932 KiB | ||||
38 | Wrong answer | 377ms | 18480 KiB | ||||
39 | Wrong answer | 389ms | 21856 KiB | ||||
40 | Wrong answer | 388ms | 26472 KiB | ||||
41 | Wrong answer | 395ms | 29196 KiB | ||||
42 | Wrong answer | 388ms | 27708 KiB |