3522 | 2023-02-28 16:53:13 | Tina0731 | Szemetessor | cpp11 | Wrong answer 17/100 | 430ms | 38320 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(long long int i=0;i<n;i++)
cin>>kapac.at(i);
for(long long 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<long long int, long long 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< long long int, long long 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 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2056 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2264 KiB | ||||
4 | Accepted | 3ms | 2512 KiB | ||||
5 | Accepted | 3ms | 2764 KiB | ||||
6 | Accepted | 3ms | 2960 KiB | ||||
7 | Accepted | 3ms | 3476 KiB | ||||
8 | Accepted | 3ms | 3436 KiB | ||||
9 | Accepted | 3ms | 3364 KiB | ||||
10 | Accepted | 3ms | 3612 KiB | ||||
11 | Accepted | 3ms | 3588 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 143ms | 9616 KiB | ||||
13 | Wrong answer | 175ms | 9880 KiB | ||||
14 | Wrong answer | 201ms | 9976 KiB | ||||
15 | Wrong answer | 221ms | 10600 KiB | ||||
16 | Wrong answer | 245ms | 11608 KiB | ||||
17 | Wrong answer | 337ms | 24180 KiB | ||||
18 | Wrong answer | 430ms | 38164 KiB | ||||
19 | Wrong answer | 428ms | 38320 KiB | ||||
20 | Wrong answer | 428ms | 38192 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 180ms | 11160 KiB | ||||
22 | Wrong answer | 232ms | 16008 KiB | ||||
23 | Accepted | 187ms | 11336 KiB | ||||
24 | Wrong answer | 221ms | 13376 KiB | ||||
25 | Accepted | 192ms | 11292 KiB | ||||
26 | Wrong answer | 308ms | 21696 KiB | ||||
27 | Wrong answer | 393ms | 28192 KiB | ||||
28 | Wrong answer | 379ms | 28584 KiB | ||||
29 | Wrong answer | 372ms | 28060 KiB | ||||
30 | Wrong answer | 333ms | 27456 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4320 KiB | ||||
32 | Accepted | 3ms | 4308 KiB | ||||
33 | Accepted | 3ms | 4436 KiB | ||||
34 | Accepted | 3ms | 4532 KiB | ||||
35 | Wrong answer | 17ms | 4872 KiB | ||||
36 | Wrong answer | 195ms | 10548 KiB | ||||
37 | Wrong answer | 381ms | 19916 KiB | ||||
38 | Wrong answer | 372ms | 18484 KiB | ||||
39 | Wrong answer | 379ms | 21732 KiB | ||||
40 | Wrong answer | 388ms | 26420 KiB | ||||
41 | Wrong answer | 393ms | 29152 KiB | ||||
42 | Wrong answer | 389ms | 27592 KiB |