3449 | 2023-02-28 09:07:10 | Ancsa | Szemetessor | cpp11 | Wrong answer 17/100 | 518ms | 25268 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 | 1680 KiB | ||||
2 | Accepted | 3ms | 1848 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2092 KiB | ||||
4 | Accepted | 3ms | 2308 KiB | ||||
5 | Accepted | 3ms | 2512 KiB | ||||
6 | Accepted | 3ms | 2752 KiB | ||||
7 | Accepted | 3ms | 2972 KiB | ||||
8 | Accepted | 3ms | 3280 KiB | ||||
9 | Accepted | 3ms | 3236 KiB | ||||
10 | Accepted | 3ms | 3452 KiB | ||||
11 | Accepted | 3ms | 3412 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 136ms | 3540 KiB | ||||
13 | Wrong answer | 173ms | 4068 KiB | ||||
14 | Wrong answer | 201ms | 4056 KiB | ||||
15 | Wrong answer | 219ms | 4224 KiB | ||||
16 | Wrong answer | 256ms | 5112 KiB | ||||
17 | Wrong answer | 372ms | 13832 KiB | ||||
18 | Wrong answer | 448ms | 24196 KiB | ||||
19 | Wrong answer | 451ms | 24324 KiB | ||||
20 | Wrong answer | 453ms | 24256 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 186ms | 5100 KiB | ||||
22 | Wrong answer | 247ms | 9176 KiB | ||||
23 | Accepted | 188ms | 5300 KiB | ||||
24 | Wrong answer | 225ms | 6824 KiB | ||||
25 | Accepted | 195ms | 5428 KiB | ||||
26 | Wrong answer | 331ms | 14452 KiB | ||||
27 | Wrong answer | 460ms | 23820 KiB | ||||
28 | Wrong answer | 437ms | 24280 KiB | ||||
29 | Wrong answer | 455ms | 24276 KiB | ||||
30 | Wrong answer | 418ms | 24796 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4644 KiB | ||||
32 | Accepted | 3ms | 4768 KiB | ||||
33 | Accepted | 3ms | 4728 KiB | ||||
34 | Accepted | 3ms | 4836 KiB | ||||
35 | Wrong answer | 20ms | 5620 KiB | ||||
36 | Wrong answer | 203ms | 4652 KiB | ||||
37 | Wrong answer | 509ms | 24948 KiB | ||||
38 | Wrong answer | 518ms | 24800 KiB | ||||
39 | Wrong answer | 505ms | 24800 KiB | ||||
40 | Wrong answer | 493ms | 24800 KiB | ||||
41 | Wrong answer | 472ms | 25056 KiB | ||||
42 | Wrong answer | 476ms | 25268 KiB |