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"Monocarp is planning to host a martial arts tournament. There will be three divisions based on weight: lightweight, middleweight and heavyweight. The winner of each division will be determined by a single elimination system. In particular, that implies that the number of participants in each division should be a power of two. Additionally, each division should have a non-zero amount of participants. n participants have registered for the tournament so far, the i -th of them weighs a_i . To split participants into divisions, Monocarp is going to establish two integer weight boundaries x and y ( x < y ). All participants who weigh strictly less than x will be considered lightweight. All participants who weigh greater or equal to y will be considered heavyweight. The remaining participants will be considered middleweight. It's possible that the distribution doesn't make the number of participants in each division a power of two. It can also lead to empty divisions. To fix the issues, Monocarp can invite an arbitrary number of participants to each division. Note that Monocarp can't kick out any of the n participants who have already registered for the tournament. However, he wants to invite as little extra participants as possible. Help Monocarp to choose x and y in such a way that the total amount of extra participants required is as small as possible. Output that amount. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of testcases. The first line of each testcase contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of the registered participants. The second line of each testcase contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= n ) -- the weights of the registered participants. The sum of n over all testcases doesn't exceed 2 cdot 10^5 . For each testcase, print a single integer -- the s"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
143025524 |
Gassa |
D |
Jan. 16, 2022, 5:09 p.m. |
OK |
D |
TESTS |
23 |
109 |
13414400 |
|
|
143033533 |
sgrfdfgryiu |
D |
Jan. 16, 2022, 6:08 p.m. |
OK |
GNU C11 |
TESTS |
23 |
608 |
2048000 |
|
|
143021423 |
Garliczz |
D |
Jan. 16, 2022, 4:58 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
46 |
819200 |
|
|
143019777 |
cylx |
D |
Jan. 16, 2022, 3:44 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
46 |
1638400 |
|
|
143050808 |
et3_tsy2.0 |
D |
Jan. 17, 2022, 3:10 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
46 |
1740800 |
|
|
143060454 |
_zhyh |
D |
Jan. 17, 2022, 5:10 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
46 |
2355200 |
|
|
143045138 |
_Diu_ |
D |
Jan. 17, 2022, 12:59 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
46 |
2457600 |
|
|
143061957 |
ConferenceCall |
D |
Jan. 17, 2022, 5:23 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
61 |
1638400 |
|
|
143031679 |
spsicio |
D |
Jan. 16, 2022, 5:51 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
819200 |
|
|
143021608 |
THE__BUG |
D |
Jan. 16, 2022, 4:59 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
1228800 |
|
|
143046276 |
nanatoday |
D |
Jan. 17, 2022, 1:37 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
1638400 |
|
|
143043161 |
lonely_lovely_ckj |
D |
Jan. 16, 2022, 11:30 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
1638400 |
|
|
143046006 |
bakekaga |
D |
Jan. 17, 2022, 1:29 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
46 |
819200 |
|
|
143046042 |
bakekaga |
D |
Jan. 17, 2022, 1:31 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
46 |
819200 |
|
|
143039237 |
ondrah |
D |
Jan. 16, 2022, 8:43 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
46 |
2457600 |
|
|
143037253 |
The_Hallak |
D |
Jan. 16, 2022, 6:56 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
46 |
4096000 |
|
|
143024217 |
lddlinan |
D |
Jan. 16, 2022, 5:05 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
46 |
9625600 |
|
|
143048095 |
Song. |
D |
Jan. 17, 2022, 2:21 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
61 |
819200 |
|
|
143060972 |
one_day |
D |
Jan. 17, 2022, 5:14 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
61 |
819200 |
|
|
143046148 |
bakekaga |
D |
Jan. 17, 2022, 1:33 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
61 |
819200 |
|
|
143019307 |
SuperPython |
D |
Jan. 16, 2022, 3:43 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
61 |
1638400 |
|
|
143021449 |
Turkhuuu |
D |
Jan. 16, 2022, 4:58 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
61 |
2457600 |
|
|
143060890 |
InFaNg |
D |
Jan. 17, 2022, 5:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
31 |
819200 |
|
|
143061805 |
Porag_2742 |
D |
Jan. 17, 2022, 5:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
31 |
2457600 |
|
|
143049941 |
wyyxhjth |
D |
Jan. 17, 2022, 2:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
819200 |
|
|
143021581 |
dgupta0812 |
D |
Jan. 16, 2022, 4:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
819200 |
|
|
143025894 |
RRRR_wys |
D |
Jan. 16, 2022, 5:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
1638400 |
|
|
143022061 |
soumilaggarwal |
D |
Jan. 16, 2022, 4:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
1638400 |
|
|
143050574 |
kutcoder |
D |
Jan. 17, 2022, 3:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
3276800 |
|
|
143037580 |
neal |
D |
Jan. 16, 2022, 7:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
3481600 |
|
|
143061429 |
Porag_2742 |
D |
Jan. 17, 2022, 5:18 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
3788800 |
|
|
143019332 |
spilopelia_senegalensis |
D |
Jan. 16, 2022, 3:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
5632000 |
|
|
143025919 |
STommydx |
D |
Jan. 16, 2022, 5:11 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
31 |
2457600 |
|
|
143030555 |
Dog_food_is_me |
D |
Jan. 16, 2022, 5:42 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
31 |
3993600 |
|
|
143021466 |
AsukaKyle |
D |
Jan. 16, 2022, 4:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
819200 |
|
|
143053889 |
YYYLLL2021 |
D |
Jan. 17, 2022, 3:53 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
819200 |
|
|
143033962 |
Kmaxkum |
D |
Jan. 16, 2022, 6:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
819200 |
|
|
143026175 |
zhoudong |
D |
Jan. 16, 2022, 5:12 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
819200 |
|
|
143023478 |
Priyansh31dec |
D |
Jan. 16, 2022, 5:03 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
1126400 |
|
|
143032512 |
Kripton2005 |
D |
Jan. 16, 2022, 5:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
1638400 |
|
|
143050838 |
TimeTraveler |
D |
Jan. 17, 2022, 3:11 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
1638400 |
|
|
143025311 |
Jo3kerR |
D |
Jan. 16, 2022, 5:08 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
1638400 |
|
|
143021313 |
Dukkha |
D |
Jan. 16, 2022, 4:58 p.m. |
OK |
Java 11 |
TESTS |
23 |
218 |
0 |
|
|
143042692 |
el_programador |
D |
Jan. 16, 2022, 11:06 p.m. |
OK |
Java 11 |
TESTS |
23 |
218 |
0 |
|
|
143020924 |
DylanSmith |
D |
Jan. 16, 2022, 4:58 p.m. |
OK |
Java 11 |
TESTS |
23 |
264 |
0 |
|
|
143038872 |
LucunJi |
D |
Jan. 16, 2022, 8:30 p.m. |
OK |
Java 11 |
TESTS |
23 |
311 |
6041600 |
|
|
143038164 |
pras7946 |
D |
Jan. 16, 2022, 8:07 p.m. |
OK |
Java 11 |
TESTS |
23 |
343 |
13926400 |
|
|
143028908 |
kamranm |
D |
Jan. 16, 2022, 5:28 p.m. |
OK |
Java 11 |
TESTS |
23 |
436 |
4812800 |
|
|
143037213 |
NatInTheHat |
D |
Jan. 16, 2022, 6:55 p.m. |
OK |
Java 11 |
TESTS |
23 |
451 |
0 |
|
|
143034140 |
MrOtter |
D |
Jan. 16, 2022, 6:15 p.m. |
OK |
Java 11 |
TESTS |
23 |
685 |
51097600 |
|
|
143030622 |
decrease_mather |
D |
Jan. 16, 2022, 5:42 p.m. |
OK |
Java 11 |
TESTS |
23 |
810 |
0 |
|
|
143029602 |
robinz62 |
D |
Jan. 16, 2022, 5:34 p.m. |
OK |
Java 11 |
TESTS |
23 |
857 |
6041600 |
|
|
143039280 |
pepelats |
D |
Jan. 16, 2022, 8:44 p.m. |
OK |
Java 8 |
TESTS |
23 |
171 |
2764800 |
|
|
143022744 |
AdhmMohamed |
D |
Jan. 16, 2022, 5:01 p.m. |
OK |
Java 8 |
TESTS |
23 |
187 |
2969600 |
|
|
143034449 |
Whiplash99 |
D |
Jan. 16, 2022, 6:19 p.m. |
OK |
Java 8 |
TESTS |
23 |
202 |
6963200 |
|
|
143022418 |
TheSawan |
D |
Jan. 16, 2022, 5 p.m. |
OK |
Java 8 |
TESTS |
23 |
233 |
2150400 |
|
|
143040191 |
2020akadaver |
D |
Jan. 16, 2022, 9:16 p.m. |
OK |
Java 8 |
TESTS |
23 |
264 |
3174400 |
|
|
143028870 |
Hemose |
D |
Jan. 16, 2022, 5:28 p.m. |
OK |
Java 8 |
TESTS |
23 |
326 |
35635200 |
|
|
143019899 |
MagentaCobra |
D |
Jan. 16, 2022, 3:44 p.m. |
OK |
Java 8 |
TESTS |
23 |
342 |
27955200 |
|
|
143028407 |
zloyrobot |
D |
Jan. 16, 2022, 5:25 p.m. |
OK |
Java 8 |
TESTS |
23 |
1091 |
3072000 |
|
|
143030330 |
jonsnow7 |
D |
Jan. 16, 2022, 5:39 p.m. |
OK |
Java 8 |
TESTS |
23 |
1310 |
0 |
|
|
143024298 |
EduRoundOnly |
D |
Jan. 16, 2022, 5:05 p.m. |
OK |
Kotlin 1.4 |
TESTS |
23 |
311 |
1843200 |
|
|
143025821 |
Alexey |
D |
Jan. 16, 2022, 5:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
187 |
3584000 |
|
|
143032778 |
fatant |
D |
Jan. 16, 2022, 6:01 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
233 |
7372800 |
|
|
143056142 |
Seungho |
D |
Jan. 17, 2022, 4:22 a.m. |
OK |
.NET Core C# |
TESTS |
23 |
358 |
16486400 |
|
|
143019630 |
mban259 |
D |
Jan. 16, 2022, 3:44 p.m. |
OK |
.NET Core C# |
TESTS |
23 |
467 |
30822400 |
|
|
143041986 |
OLOGY |
D |
Jan. 16, 2022, 10:32 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
420 |
14540800 |
|
|
143026570 |
anishde85 |
D |
Jan. 16, 2022, 5:14 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
358 |
20889600 |
|
|
143034910 |
dynamic-26 |
D |
Jan. 16, 2022, 6:24 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
404 |
22323200 |
|
|
143043217 |
Bad_day_toCode |
D |
Jan. 16, 2022, 11:33 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
421 |
29388800 |
|
|
143030306 |
raideva |
D |
Jan. 16, 2022, 5:39 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
483 |
28364800 |
|
|
143025011 |
kikokushijo |
D |
Jan. 16, 2022, 5:07 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
654 |
27750400 |
|
|
143031296 |
titia |
D |
Jan. 16, 2022, 5:48 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
764 |
18124800 |
|
|
143040549 |
dominator1234 |
D |
Jan. 16, 2022, 9:31 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
764 |
19763200 |
|
|
143031203 |
sangram03 |
D |
Jan. 16, 2022, 5:47 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
794 |
22118400 |
|
|
143028233 |
hxu10 |
D |
Jan. 16, 2022, 5:24 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
795 |
17817600 |
|
|
143025494 |
Apoorv_Rathore |
D |
Jan. 16, 2022, 5:09 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
810 |
16896000 |
|
|
143025458 |
vilhelmthorsson |
D |
Jan. 16, 2022, 5:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
280 |
17408000 |
|
|
143052963 |
lemiao12 |
D |
Jan. 17, 2022, 3:40 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
421 |
30105600 |
|
|
143025345 |
ding_don_dino |
D |
Jan. 16, 2022, 5:08 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
436 |
23552000 |
|
|
143023349 |
swoon |
D |
Jan. 16, 2022, 5:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
514 |
22220800 |
|
|
143042015 |
OLOGY |
D |
Jan. 16, 2022, 10:33 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
561 |
26009600 |
|
|
143023036 |
mathdude42 |
D |
Jan. 16, 2022, 5:01 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
561 |
27443200 |
|
|
143022049 |
ankan2526 |
D |
Jan. 16, 2022, 4:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
764 |
44032000 |
|
|
143047106 |
zqx1392 |
D |
Jan. 17, 2022, 1:58 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
1216 |
24371200 |
|
|
143039596 |
gustavofadel |
D |
Jan. 16, 2022, 8:54 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
1232 |
23244800 |
|
|
143025557 |
DBabichev |
D |
Jan. 16, 2022, 5:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
1247 |
26316800 |
|
|
143041975 |
OLOGY |
D |
Jan. 16, 2022, 10:31 p.m. |
OK |
Python 2 |
TESTS |
23 |
358 |
12288000 |
|
|
143040058 |
OLOGY |
D |
Jan. 16, 2022, 9:12 p.m. |
OK |
Python 2 |
TESTS |
23 |
405 |
12185600 |
|
|
143039958 |
OLOGY |
D |
Jan. 16, 2022, 9:08 p.m. |
OK |
Python 2 |
TESTS |
23 |
436 |
12288000 |
|
|
143040226 |
OLOGY |
D |
Jan. 16, 2022, 9:18 p.m. |
OK |
Python 2 |
TESTS |
23 |
529 |
12288000 |
|
|
143039424 |
OLOGY |
D |
Jan. 16, 2022, 8:48 p.m. |
OK |
Python 2 |
TESTS |
23 |
529 |
12288000 |
|
|
143039404 |
OLOGY |
D |
Jan. 16, 2022, 8:48 p.m. |
OK |
Python 2 |
TESTS |
23 |
577 |
12288000 |
|
|
143037832 |
OLOGY |
D |
Jan. 16, 2022, 7:56 p.m. |
OK |
Python 2 |
TESTS |
23 |
592 |
12185600 |
|
|
143038370 |
kroyl |
D |
Jan. 16, 2022, 8:14 p.m. |
OK |
Rust 2021 |
TESTS |
23 |
31 |
7680000 |
|
|
143045446 |
clause |
D |
Jan. 17, 2022, 1:11 a.m. |
OK |
Rust 2021 |
TESTS |
23 |
140 |
3174400 |
|
|
143021539 |
maan2003 |
D |
Jan. 16, 2022, 4:59 p.m. |
OK |
Rust 2021 |
TESTS |
23 |
187 |
7884800 |
|
|
143023794 |
apilat |
D |
Jan. 16, 2022, 5:03 p.m. |
OK |
Rust 2021 |
TESTS |
23 |
1278 |
17510400 |
|
|
143022487 |
Soheil96 |
D |
Jan. 16, 2022, 5 p.m. |
OK |
Scala |
TESTS |
23 |
950 |
3584000 |
|
|
remove filters
Back to search problems