Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest amount of money you need to spend on bribing to win the elections. To win elections you need to have strictly more votes than any other candidate. First line contains one integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105) -- number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105; 0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89104) -- number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the candidate 0 (so if a voter wants to vote for you, ai is equal to zero, in which case bi will also be equal to zero). Print one integer -- smallest amount of money you need to spend to win the elections.'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
7417841 |
Alex_2oo8 |
C |
Aug. 10, 2014, 6:11 p.m. |
OK |
FPC |
TESTS |
94 |
78 |
4505600 |
|
2100 |
7423147 |
Accelerator_916852 |
C |
Aug. 11, 2014, 3:58 a.m. |
OK |
GNU C++ |
TESTS |
94 |
46 |
3788800 |
|
2100 |
13927437 |
130705009 |
C |
Oct. 29, 2015, 5:53 a.m. |
OK |
GNU C++ |
TESTS |
94 |
62 |
1740800 |
|
2100 |
20383348 |
vjudge5 |
C |
Sept. 4, 2016, 1:38 p.m. |
OK |
GNU C++ |
TESTS |
94 |
62 |
2048000 |
|
2100 |
40922950 |
vjudge1 |
C |
July 29, 2018, 4:05 p.m. |
OK |
GNU C++ |
TESTS |
94 |
62 |
3379200 |
|
2100 |
7677770 |
no_tomorrow |
C |
Sept. 3, 2014, 9:55 p.m. |
OK |
GNU C++ |
TESTS |
94 |
62 |
4710400 |
|
2100 |
7677737 |
no_tomorrow |
C |
Sept. 3, 2014, 9:43 p.m. |
OK |
GNU C++ |
TESTS |
94 |
62 |
4710400 |
|
2100 |
32447632 |
pegasas |
C |
Nov. 19, 2017, 5:09 a.m. |
OK |
GNU C++ |
TESTS |
94 |
62 |
5734400 |
|
2100 |
9243893 |
whn6325689 |
C |
Dec. 24, 2014, 1:15 p.m. |
OK |
GNU C++ |
TESTS |
94 |
77 |
1740800 |
|
2100 |
7654475 |
hiyot |
C |
Aug. 31, 2014, 1:24 p.m. |
OK |
GNU C++ |
TESTS |
94 |
77 |
4710400 |
|
2100 |
7427519 |
DXY |
C |
Aug. 11, 2014, 1:24 p.m. |
OK |
GNU C++ |
TESTS |
94 |
77 |
9830400 |
|
2100 |
7447659 |
choice |
C |
Aug. 14, 2014, 6:57 p.m. |
OK |
GNU C++0x |
TESTS |
94 |
62 |
5017600 |
|
2100 |
7429388 |
choice |
C |
Aug. 11, 2014, 4:31 p.m. |
OK |
GNU C++0x |
TESTS |
94 |
62 |
5017600 |
|
2100 |
7420520 |
choice |
C |
Aug. 10, 2014, 7:40 p.m. |
OK |
GNU C++0x |
TESTS |
94 |
62 |
5017600 |
|
2100 |
7418029 |
ecnerwala |
C |
Aug. 10, 2014, 6:17 p.m. |
OK |
GNU C++0x |
TESTS |
94 |
62 |
7884800 |
|
2100 |
7421048 |
tloinuy |
C |
Aug. 10, 2014, 7:58 p.m. |
OK |
GNU C++0x |
TESTS |
94 |
77 |
5529600 |
|
2100 |
7417096 |
ikatanic |
C |
Aug. 10, 2014, 5:53 p.m. |
OK |
GNU C++0x |
TESTS |
94 |
78 |
5017600 |
|
2100 |
7423414 |
MatRush |
C |
Aug. 11, 2014, 4:45 a.m. |
OK |
GNU C++0x |
TESTS |
94 |
108 |
8396800 |
|
2100 |
7732809 |
saketh |
C |
Sept. 10, 2014, 6:38 a.m. |
OK |
GNU C++0x |
TESTS |
94 |
140 |
4403200 |
|
2100 |
7419603 |
Alexus |
C |
Aug. 10, 2014, 7:07 p.m. |
OK |
GNU C++0x |
TESTS |
94 |
155 |
8294400 |
|
2100 |
7417525 |
voover |
C |
Aug. 10, 2014, 6:03 p.m. |
OK |
GNU C++0x |
TESTS |
94 |
155 |
11161600 |
|
2100 |
45313028 |
cy13 |
C |
Nov. 5, 2018, 6:07 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
62 |
3379200 |
|
2100 |
64881314 |
nantf |
C |
Nov. 14, 2019, 11:43 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
62 |
4812800 |
|
2100 |
64881180 |
nantf |
C |
Nov. 14, 2019, 11:41 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
62 |
4812800 |
|
2100 |
59901343 |
2016wudi |
C |
Sept. 2, 2019, 1:47 p.m. |
OK |
GNU C++11 |
TESTS |
94 |
77 |
5939200 |
|
2100 |
17139912 |
joisino |
C |
April 3, 2016, 5:06 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
77 |
6246400 |
|
2100 |
17152212 |
freebsdx |
C |
April 4, 2016, 1:59 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
78 |
3891200 |
|
2100 |
40867118 |
vjudge4 |
C |
July 28, 2018, 4:15 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
78 |
5836800 |
|
2100 |
44106036 |
137_345_2814 |
C |
Oct. 11, 2018, 9:17 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
78 |
6451200 |
|
2100 |
35111728 |
vjudge5 |
C |
Feb. 10, 2018, 5:07 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
78 |
8704000 |
|
2100 |
17916627 |
fengsuiyan |
C |
May 15, 2016, 7:52 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
78 |
8704000 |
|
2100 |
32122139 |
andwho |
C |
Nov. 7, 2017, 2:40 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
78 |
6144000 |
|
2100 |
41524194 |
Dennord |
C |
Aug. 12, 2018, 10:56 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
108 |
5017600 |
|
2100 |
56418530 |
vjudge3 |
C |
July 2, 2019, 6:10 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
109 |
2048000 |
|
2100 |
49434105 |
yaksha |
C |
Feb. 3, 2019, 5:37 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
109 |
4915200 |
|
2100 |
38384367 |
OmarHashim |
C |
May 17, 2018, 11:05 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
171 |
6963200 |
|
2100 |
34412520 |
Maffka |
C |
Jan. 21, 2018, 11:53 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
218 |
4915200 |
|
2100 |
20354881 |
vjudge2 |
C |
Sept. 3, 2016, 7:18 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
233 |
8908800 |
|
2100 |
69474109 |
vjudge5 |
C |
Jan. 24, 2020, 3:32 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
390 |
3481600 |
|
2100 |
50278708 |
bhargav_0085 |
C |
Feb. 21, 2019, 11:39 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
405 |
3072000 |
|
2100 |
68859779 |
vjudge3 |
C |
Jan. 15, 2020, 11:43 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
405 |
3481600 |
|
2100 |
62372387 |
Phortox |
C |
Oct. 11, 2019, 4:10 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
78 |
3379200 |
|
2100 |
52970368 |
vjudge1 |
C |
April 18, 2019, 4:18 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
93 |
5120000 |
|
2100 |
56271111 |
vjudge1 |
C |
June 29, 2019, 12:08 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
109 |
2048000 |
|
2100 |
56270480 |
vjudge2 |
C |
June 29, 2019, 11:53 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
109 |
2048000 |
|
2100 |
56295447 |
vjudge1 |
C |
June 30, 2019, 5:31 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
109 |
5120000 |
|
2100 |
56269625 |
Devshoo |
C |
June 29, 2019, 11:34 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
109 |
5120000 |
|
2100 |
58147999 |
bluefi |
C |
Aug. 2, 2019, 12:01 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
109 |
9625600 |
|
2100 |
41576409 |
vjudge4 |
C |
Aug. 14, 2018, 5:12 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
124 |
5120000 |
|
2100 |
61199199 |
SsSsoOoOoOo |
C |
Sept. 24, 2019, 7:01 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
124 |
109977600 |
|
2100 |
42732181 |
err0r |
C |
Sept. 10, 2018, 12:09 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
156 |
12185600 |
|
2100 |
7419681 |
jonathanpaulson |
C |
Aug. 10, 2014, 7:10 p.m. |
OK |
Java 7 |
TESTS |
94 |
374 |
14233600 |
|
2100 |
7432042 |
Fouzelddin |
C |
Aug. 12, 2014, 3:41 a.m. |
OK |
Java 7 |
TESTS |
94 |
389 |
13824000 |
|
2100 |
10033594 |
mkirsche |
C |
Feb. 26, 2015, 2:33 p.m. |
OK |
Java 8 |
TESTS |
94 |
249 |
0 |
|
2100 |
7990100 |
AlexFetisov |
C |
Sept. 28, 2014, 3:58 a.m. |
OK |
Java 8 |
TESTS |
94 |
529 |
2457600 |
|
2100 |
19554916 |
alibaba |
C |
Aug. 1, 2016, 8:25 a.m. |
OK |
Java 8 |
TESTS |
94 |
904 |
5632000 |
|
2100 |
7510170 |
gualex |
C |
Aug. 19, 2014, 4:34 p.m. |
OK |
MS C# |
TESTS |
94 |
124 |
9830400 |
|
2100 |
9730840 |
azukun |
C |
Feb. 5, 2015, 7:08 p.m. |
OK |
MS C# |
TESTS |
94 |
280 |
15257600 |
|
2100 |
35823838 |
vjudge2 |
C |
March 2, 2018, 2:58 a.m. |
OK |
MS C++ |
TESTS |
94 |
46 |
8499200 |
|
2100 |
56308741 |
vjudge1 |
C |
June 30, 2019, 1:32 p.m. |
OK |
MS C++ |
TESTS |
94 |
93 |
6144000 |
|
2100 |
7435296 |
kroaity |
C |
Aug. 12, 2014, 2:07 p.m. |
OK |
MS C++ |
TESTS |
94 |
93 |
6348800 |
|
2100 |
53163154 |
vjudge4 |
C |
April 22, 2019, 4:59 p.m. |
OK |
MS C++ |
TESTS |
94 |
93 |
10240000 |
|
2100 |
7417612 |
RAD |
C |
Aug. 10, 2014, 6:05 p.m. |
OK |
MS C++ |
TESTS |
94 |
109 |
13209600 |
|
2100 |
56295158 |
vjudge2 |
C |
June 30, 2019, 5:17 a.m. |
OK |
MS C++ |
TESTS |
94 |
171 |
2867200 |
|
2100 |
56291903 |
vjudge5 |
C |
June 30, 2019, 2:03 a.m. |
OK |
MS C++ |
TESTS |
94 |
217 |
3379200 |
|
2100 |
8440059 |
Manul |
C |
Oct. 27, 2014, 9:33 p.m. |
OK |
MS C++ |
TESTS |
94 |
218 |
6553600 |
|
2100 |
56455482 |
vjudge5 |
C |
July 3, 2019, 3:29 a.m. |
OK |
MS C++ |
TESTS |
94 |
234 |
3174400 |
|
2100 |
35926247 |
jintian1529 |
C |
March 4, 2018, 3:07 p.m. |
OK |
MS C++ |
TESTS |
94 |
280 |
14336000 |
|
2100 |
68851158 |
vjudge5 |
C |
Jan. 15, 2020, 9 a.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
686 |
5939200 |
|
2100 |
remove filters
Back to search problems