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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1978 | Codeforces Round 953 (Div. 2) | FINISHED | False | 7200 | 13294499 | June 16, 2024, 9:05 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 11329 ) | D | Elections | PROGRAMMING | data structures greedy implementation math |
B"Elections are taking place in Berland. There are n candidates participating in the elections, numbered from 1 to n . The i -th candidate has a_i fans who will vote for him. Additionally, there are c people who are undecided about their favorite candidate, let's call them undecided. Undecided people will vote for the candidate with the lowest number. The candidate who receives the maximum number of votes wins the elections, and if multiple candidates receive the same maximum number of votes, the candidate with the lowest number among them wins. You found these elections too boring and predictable, so you decided to exclude some candidates from them. If you do not allow candidate number i to participate in the elections, all a_i of his fans will become undecided, and will vote for the candidate with the lowest number. You are curious to find, for each i from 1 to n , the minimum number of candidates that need to be excluded from the elections for candidate number i to win the elections. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 2 cdot 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains two integers n and c ( 1 <= n <= 2 cdot 10^5 , 0 <= c <= 10^9 ) -- the number of candidates in the elections and the number of undecided people. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 10^9 ) -- the number of fans for each candidate. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output n integers, the i -th of which should be equal to the minimum number of candidates that need to be excluded from the elections for candidate number i to win. In the first test case: In the second test case, "... |
130527 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
266118806 | GVJNJ | D | June 16, 2024, 11:47 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 109 | 0 | ||
266110576 | Assaf_Script | D | June 16, 2024, 8:21 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 109 | 1638400 | ||
266121407 | MultiTrackKind | D | June 17, 2024, 1:05 a.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 109 | 2457600 | ||
266098544 | Amisha8899 | D | June 16, 2024, 5:50 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 124 | 0 | ||
266081615 | meet_rv | D | June 16, 2024, 3:23 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 124 | 0 | ||
266072460 | yanfu1009 | D | June 16, 2024, 2:11 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 124 | 0 | ||
266121557 | MultiTrackKind | D | June 17, 2024, 1:09 a.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 124 | 819200 | ||
266098929 | ashibh | D | June 16, 2024, 5:54 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 124 | 4198400 | ||
266078198 | Rishabhpndt | D | June 16, 2024, 2:59 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 124 | 4198400 | ||
266081884 | CaP_TaIn | D | June 16, 2024, 3:25 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 124 | 5324800 | ||
266135913 | yyw233 | D | June 17, 2024, 5:16 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 93 | 0 | ||
266102146 | yuvraj261104 | D | June 16, 2024, 6:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 108 | 4198400 | ||
266121778 | Prerak_7108 | D | June 17, 2024, 1:14 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 108 | 4505600 | ||
266121700 | Atom_Hoang | D | June 17, 2024, 1:12 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 108 | 11468800 | ||
266127929 | NoLimitCoder | D | June 17, 2024, 3:16 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 109 | 0 | ||
266125693 | djrfrn | D | June 17, 2024, 2:39 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 109 | 0 | ||
266114140 | arjun098 | D | June 16, 2024, 9:33 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 109 | 0 | ||
266108936 | mercer_2.0 | D | June 16, 2024, 7:53 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 109 | 0 | ||
266105098 | Kanheyalal | D | June 16, 2024, 7 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 109 | 0 | ||
266104484 | HellobuddyJr | D | June 16, 2024, 6:53 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 109 | 0 | ||
266119600 | N_z__ | D | June 17, 2024, 12:12 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 62 | 204800 | ||
266129646 | abhishekp21 | D | June 17, 2024, 3:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 78 | 102400 | ||
266133016 | pracLog | D | June 17, 2024, 4:35 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 78 | 5222400 | ||
266133849 | Stronger_Than_Kdlyh | D | June 17, 2024, 4:48 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 92 | 4096000 | ||
266126732 | avin_ash | D | June 17, 2024, 2:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 92 | 8089600 | ||
266139191 | _contest1_ | D | June 17, 2024, 5:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 93 | 0 | ||
266127458 | rohitmatrix2004 | D | June 17, 2024, 3:08 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 93 | 0 | ||
266124927 | nehcoah | D | June 17, 2024, 2:24 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 93 | 0 | ||
266115980 | Omar_Hani | D | June 16, 2024, 10:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 93 | 0 | ||
266109372 | pratap_s | D | June 16, 2024, 8 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 93 | 0 | ||
266098525 | rainboy | D | June 16, 2024, 5:50 p.m. | OK | GNU C11 | TESTS | 25 | 812 | 921600 | ||
266105568 | frocemetocode | D | June 16, 2024, 7:06 p.m. | OK | GNU C11 | TESTS | 25 | 890 | 1740800 | ||
266113959 | Roshan_Y_Singh | D | June 16, 2024, 9:28 p.m. | OK | GNU C11 | TESTS | 25 | 890 | 4096000 | ||
266125815 | priyaroy3370 | D | June 17, 2024, 2:41 a.m. | OK | Java 21 | TESTS | 25 | 296 | 4608000 | ||
266137690 | gaju_01 | D | June 17, 2024, 5:39 a.m. | OK | Java 21 | TESTS | 25 | 343 | 4915200 | ||
266122829 | ChrizzyB47 | D | June 17, 2024, 1:40 a.m. | OK | Java 21 | TESTS | 25 | 358 | 4608000 | ||
266128616 | dzhi | D | June 17, 2024, 3:26 a.m. | OK | Java 21 | TESTS | 25 | 358 | 5222400 | ||
266065731 | vinay_panwar | D | June 16, 2024, 1:23 p.m. | OK | Java 21 | TESTS | 25 | 358 | 13004800 | ||
266112045 | BlizGale | D | June 16, 2024, 8:48 p.m. | OK | Java 21 | TESTS | 25 | 359 | 7065600 | ||
266084063 | SweetAsCocaine | D | June 16, 2024, 3:43 p.m. | OK | Java 21 | TESTS | 25 | 374 | 5017600 | ||
266101306 | Akash_Sardar | D | June 16, 2024, 6:17 p.m. | OK | Java 21 | TESTS | 25 | 483 | 20889600 | ||
266093226 | anshs10 | D | June 16, 2024, 5 p.m. | OK | Java 21 | TESTS | 25 | 499 | 21094400 | ||
266115252 | lpychemistry | D | June 16, 2024, 10 p.m. | OK | Java 21 | TESTS | 25 | 499 | 23961600 | ||
266122934 | nis1234 | D | June 17, 2024, 1:42 a.m. | OK | Java 8 | TESTS | 25 | 202 | 0 | ||
266106860 | NerfThis | D | June 16, 2024, 7:23 p.m. | OK | Java 8 | TESTS | 25 | 233 | 13619200 | ||
266077509 | Sumitsingh7 | D | June 16, 2024, 2:53 p.m. | OK | Java 8 | TESTS | 25 | 468 | 8601600 | ||
266076964 | darkstars_stars | D | June 16, 2024, 2:49 p.m. | OK | Java 8 | TESTS | 25 | 468 | 8601600 | ||
266126154 | TriNitroTofu | D | June 17, 2024, 2:47 a.m. | OK | Java 8 | TESTS | 25 | 484 | 10752000 | ||
266128181 | achyut88 | D | June 17, 2024, 3:19 a.m. | OK | Java 8 | TESTS | 25 | 499 | 11980800 | ||
266069059 | kasiru_69 | D | June 16, 2024, 1:51 p.m. | OK | Java 8 | TESTS | 25 | 499 | 15462400 | ||
266139470 | coderman2004 | D | June 17, 2024, 6 a.m. | OK | Java 8 | TESTS | 25 | 515 | 11980800 | ||
266130660 | Pranav_Sharda | D | June 17, 2024, 3:57 a.m. | OK | Java 8 | TESTS | 25 | 671 | 38912000 | ||
266136131 | bully_maguire | D | June 17, 2024, 5:19 a.m. | OK | Java 8 | TESTS | 25 | 703 | 0 | ||
266076047 | L-S-S | D | June 16, 2024, 2:41 p.m. | OK | Kotlin 1.7 | TESTS | 25 | 796 | 137216000 | ||
266092847 | y4n9b0 | D | June 16, 2024, 4:57 p.m. | OK | Kotlin 1.9 | TESTS | 25 | 359 | 23347200 | ||
266091048 | y4n9b0 | D | June 16, 2024, 4:40 p.m. | OK | Kotlin 1.9 | TESTS | 25 | 374 | 22220800 | ||
266092297 | y4n9b0 | D | June 16, 2024, 4:52 p.m. | OK | Kotlin 1.9 | TESTS | 25 | 374 | 23347200 | ||
266093151 | y4n9b0 | D | June 16, 2024, 4:59 p.m. | OK | Kotlin 1.9 | TESTS | 25 | 375 | 23347200 | ||
266089925 | y4n9b0 | D | June 16, 2024, 4:31 p.m. | OK | Kotlin 1.9 | TESTS | 25 | 389 | 20992000 | ||
266091246 | y4n9b0 | D | June 16, 2024, 4:42 p.m. | OK | Kotlin 1.9 | TESTS | 25 | 390 | 23347200 | ||
266063120 | rsFalse | D | June 16, 2024, 1:03 p.m. | OK | Perl | TESTS | 25 | 343 | 50995200 | ||
266081747 | __rose | D | June 16, 2024, 3:24 p.m. | OK | PyPy 3 | TESTS | 25 | 452 | 24166400 | ||
266130761 | cyan17 | D | June 17, 2024, 3:59 a.m. | OK | PyPy 3 | TESTS | 25 | 531 | 19456000 | ||
266125223 | LChenl | D | June 17, 2024, 2:30 a.m. | OK | PyPy 3 | TESTS | 25 | 639 | 21504000 | ||
266070050 | YMSeah | D | June 16, 2024, 1:59 p.m. | OK | PyPy 3-64 | TESTS | 25 | 171 | 29798400 | ||
266077674 | LightHouse1 | D | June 16, 2024, 2:54 p.m. | OK | PyPy 3-64 | TESTS | 25 | 171 | 35430400 | ||
266069706 | YMSeah | D | June 16, 2024, 1:57 p.m. | OK | PyPy 3-64 | TESTS | 25 | 187 | 29388800 | ||
266112167 | singh.eureka | D | June 16, 2024, 8:51 p.m. | OK | PyPy 3-64 | TESTS | 25 | 187 | 31948800 | ||
266094409 | jiangjinjinyxt | D | June 16, 2024, 5:11 p.m. | OK | PyPy 3-64 | TESTS | 25 | 187 | 32358400 | ||
266074708 | Horse-chan | D | June 16, 2024, 2:30 p.m. | OK | PyPy 3-64 | TESTS | 25 | 187 | 35430400 | ||
266114652 | PhenomSG | D | June 16, 2024, 9:45 p.m. | OK | PyPy 3-64 | TESTS | 25 | 187 | 36556800 | ||
266107653 | RobinFromTheHood | D | June 16, 2024, 7:35 p.m. | OK | PyPy 3-64 | TESTS | 25 | 202 | 31129600 | ||
266112191 | singh.eureka | D | June 16, 2024, 8:51 p.m. | OK | PyPy 3-64 | TESTS | 25 | 202 | 31436800 | ||
266088261 | Poricf | D | June 16, 2024, 4:17 p.m. | OK | PyPy 3-64 | TESTS | 25 | 202 | 31948800 | ||
266069941 | yatendra1999 | D | June 16, 2024, 1:59 p.m. | OK | Python 3 | TESTS | 25 | 264 | 35123200 | ||
266065492 | lord_of_the_flies | D | June 16, 2024, 1:21 p.m. | OK | Python 3 | TESTS | 25 | 265 | 35532800 | ||
266122453 | marszhanghaoliang | D | June 17, 2024, 1:31 a.m. | OK | Python 3 | TESTS | 25 | 265 | 40140800 | ||
266080860 | hiding_ | D | June 16, 2024, 3:18 p.m. | OK | Python 3 | TESTS | 25 | 296 | 27852800 | ||
266137278 | robai2002 | D | June 17, 2024, 5:34 a.m. | OK | Python 3 | TESTS | 25 | 359 | 27750400 | ||
266070433 | crypticcoder | D | June 16, 2024, 2:03 p.m. | OK | Python 3 | TESTS | 25 | 359 | 35840000 | ||
266132370 | ___a_s_1_2___ | D | June 17, 2024, 4:25 a.m. | OK | Python 3 | TESTS | 25 | 374 | 27750400 | ||
266131659 | KrishBhimani | D | June 17, 2024, 4:14 a.m. | OK | Python 3 | TESTS | 25 | 453 | 35123200 | ||
266085344 | prathamsibal81 | D | June 16, 2024, 3:53 p.m. | OK | Python 3 | TESTS | 25 | 468 | 31129600 | ||
266075975 | Vema | D | June 16, 2024, 2:41 p.m. | OK | Python 3 | TESTS | 25 | 483 | 31129600 | ||
266117535 | 0x81 | D | June 16, 2024, 11:08 p.m. | OK | Ruby 3 | TESTS | 25 | 578 | 32665600 | ||
266097047 | kingcabrams | D | June 16, 2024, 5:35 p.m. | OK | Rust 2021 | TESTS | 25 | 124 | 5222400 | ||
266117473 | M1ngXu | D | June 16, 2024, 11:06 p.m. | OK | Rust 2021 | TESTS | 25 | 124 | 7987200 |
Back to search problems