10691 | 2024-04-09 15:33:25 | Ancsa | Szemetessor | cpp17 | Wrong answer 17/100 | 509ms | 125132 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2052 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2256 KiB | ||||
4 | Accepted | 3ms | 2504 KiB | ||||
5 | Accepted | 3ms | 2756 KiB | ||||
6 | Accepted | 3ms | 2964 KiB | ||||
7 | Accepted | 3ms | 3020 KiB | ||||
8 | Accepted | 3ms | 3080 KiB | ||||
9 | Accepted | 3ms | 3092 KiB | ||||
10 | Accepted | 3ms | 3220 KiB | ||||
11 | Accepted | 3ms | 3184 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 136ms | 5244 KiB | ||||
13 | Wrong answer | 173ms | 7420 KiB | ||||
14 | Wrong answer | 202ms | 10136 KiB | ||||
15 | Wrong answer | 218ms | 12884 KiB | ||||
16 | Wrong answer | 254ms | 16508 KiB | ||||
17 | Wrong answer | 370ms | 29756 KiB | ||||
18 | Wrong answer | 439ms | 45412 KiB | ||||
19 | Wrong answer | 439ms | 50388 KiB | ||||
20 | Wrong answer | 439ms | 55472 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 186ms | 38632 KiB | ||||
22 | Wrong answer | 244ms | 45248 KiB | ||||
23 | Accepted | 186ms | 43572 KiB | ||||
24 | Wrong answer | 229ms | 47848 KiB | ||||
25 | Accepted | 194ms | 48668 KiB | ||||
26 | Wrong answer | 331ms | 61532 KiB | ||||
27 | Wrong answer | 432ms | 75888 KiB | ||||
28 | Wrong answer | 442ms | 81568 KiB | ||||
29 | Wrong answer | 442ms | 86624 KiB | ||||
30 | Wrong answer | 405ms | 91152 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 70796 KiB | ||||
32 | Accepted | 3ms | 70804 KiB | ||||
33 | Accepted | 3ms | 70916 KiB | ||||
34 | Accepted | 3ms | 71060 KiB | ||||
35 | Wrong answer | 20ms | 72200 KiB | ||||
36 | Wrong answer | 202ms | 74024 KiB | ||||
37 | Wrong answer | 509ms | 99248 KiB | ||||
38 | Wrong answer | 508ms | 104404 KiB | ||||
39 | Wrong answer | 501ms | 109464 KiB | ||||
40 | Wrong answer | 481ms | 114628 KiB | ||||
41 | Wrong answer | 472ms | 119836 KiB | ||||
42 | Wrong answer | 477ms | 125132 KiB |