Codeforces Global Round 29 (Div. 1 + Div. 2)

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
2147 Codeforces Global Round 29 (Div. 1 + Div. 2) FINISHED False 10800 18026723 Sept. 20, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 7430 ) D Game on Array PROGRAMMING games greedy

You are given an array (a) of (n) positive integers. Alice and Bob will play a game with this array. They will take alternating turns, with Alice going first. At each turn, the player must choose a value (x>0) that appears in (a) at least once. Then, the player earns (1) point for each value (x) in the array, each value (x) in the array is decreased by (1) and becomes (x-1). The game ends when no (x) can be chosen; that is, when all the elements in the array are zero. Given that both players want to maximize their points and play optimally, calculate the amount of points that each player will end up with. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test case contains an integer (n) ((1 \leq n \leq 2\cdot 10^{5})) — the size of the array. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \leq a_i \leq 10^{9})) — the elements of the array. It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot 10^{5}). For each test case, output two integers, the amount of points Alice and Bob will get if both play optimally. Visualizer link In the first test case, Alice chooses (x=1) with her first move. The array becomes (2,0,0) and she earns (2) points. After that, Bob is forced to choose (x=2). The array becomes (1,0,0) and Bob earns (1) point. Finally, Alice is forced to choose (x=1) and earn one more point. After that, the array is (0,0,0), so the game ends. In total, Alice finishes with (3) points and Bob with (1) point. In the third test case, each player will decrement all the elements and earn (4) points each move. Alice will earn (5 \cdot 4 = 20) points while Bob will only earn (4\cdot 4 = 16) points.

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
339637636 Adhirajg22 D Sept. 21, 2025, 12:42 a.m. OK C++17 (GCC 7-32) TESTS 21 93 0
339626204 CYCcc D Sept. 20, 2025, 8:41 p.m. OK C++17 (GCC 7-32) TESTS 21 93 0
339637616 Adhirajg22 D Sept. 21, 2025, 12:41 a.m. OK C++17 (GCC 7-32) TESTS 21 93 102400
339639470 HD0X_____ D Sept. 21, 2025, 1:35 a.m. OK C++17 (GCC 7-32) TESTS 21 93 819200
339618128 Ertzyk D Sept. 20, 2025, 7:28 p.m. OK C++17 (GCC 7-32) TESTS 21 108 0
339641233 cxf2006 D Sept. 21, 2025, 2:15 a.m. OK C++17 (GCC 7-32) TESTS 21 108 819200
339617094 aparesy56 D Sept. 20, 2025, 7:20 p.m. OK C++17 (GCC 7-32) TESTS 21 108 819200
339649575 lividream D Sept. 21, 2025, 4:46 a.m. OK C++17 (GCC 7-32) TESTS 21 108 2457600
339634966 hyenje29 D Sept. 20, 2025, 11:09 p.m. OK C++17 (GCC 7-32) TESTS 21 109 102400
339613947 Salamnka D Sept. 20, 2025, 6:58 p.m. OK C++17 (GCC 7-32) TESTS 21 109 102400
339656474 _Venti D Sept. 21, 2025, 6:04 a.m. OK C++20 (GCC 13-64) TESTS 21 77 0
339637025 www_bilibili_com D Sept. 21, 2025, 12:20 a.m. OK C++20 (GCC 13-64) TESTS 21 77 1740800
339645040 _Venti D Sept. 21, 2025, 3:30 a.m. OK C++20 (GCC 13-64) TESTS 21 93 0
339640785 SecretOperation D Sept. 21, 2025, 2:05 a.m. OK C++20 (GCC 13-64) TESTS 21 93 0
339628334 SecretOperation D Sept. 20, 2025, 9:03 p.m. OK C++20 (GCC 13-64) TESTS 21 93 0
339622736 Criocs D Sept. 20, 2025, 8:07 p.m. OK C++20 (GCC 13-64) TESTS 21 93 0
339625952 emvy D Sept. 20, 2025, 8:38 p.m. OK C++20 (GCC 13-64) TESTS 21 93 102400
339611931 Ahmed_Ashraf_f D Sept. 20, 2025, 6:46 p.m. OK C++20 (GCC 13-64) TESTS 21 93 1126400
339596447 Baqtraqking D Sept. 20, 2025, 5:12 p.m. OK C++20 (GCC 13-64) TESTS 21 93 1126400
339641012 hhhgjyismine D Sept. 21, 2025, 2:10 a.m. OK C++20 (GCC 13-64) TESTS 21 93 1638400
339643104 Moyou D Sept. 21, 2025, 2:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 78 4812800
339646927 yvbf D Sept. 21, 2025, 4:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339645063 H19wk D Sept. 21, 2025, 3:31 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339636777 coolkid1412 D Sept. 21, 2025, 12:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339634046 albrecht D Sept. 20, 2025, 10:38 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339620936 rgnerdplayer D Sept. 20, 2025, 7:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339616108 akrobatik D Sept. 20, 2025, 7:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339614721 tch1cherin D Sept. 20, 2025, 7:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339612562 BambooTree D Sept. 20, 2025, 6:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339596913 SingularityPoint D Sept. 20, 2025, 5:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 0
339615411 ruban D Sept. 20, 2025, 7:08 p.m. OK FPC TESTS 21 421 162508800
339590670 pengin_2000 D Sept. 20, 2025, 4:55 p.m. OK GNU C11 TESTS 21 124 4915200
339594462 k.saijaswanth D Sept. 20, 2025, 5:06 p.m. OK Go TESTS 21 140 13414400
339622327 mostafadragonx D Sept. 20, 2025, 8:03 p.m. OK Go TESTS 21 171 13721600
339637745 habib_48 D Sept. 21, 2025, 12:45 a.m. OK Java 21 TESTS 21 406 5324800
339598860 mzip D Sept. 20, 2025, 5:19 p.m. OK Java 21 TESTS 21 406 18124800
339594756 mastacoda D Sept. 20, 2025, 5:07 p.m. OK Java 21 TESTS 21 421 24576000
339628683 GeneralBihari D Sept. 20, 2025, 9:07 p.m. OK Java 21 TESTS 21 437 19353600
339633118 cstemp D Sept. 20, 2025, 10:12 p.m. OK Java 21 TESTS 21 467 19660800
339591132 SumitXorY D Sept. 20, 2025, 4:56 p.m. OK Java 21 TESTS 21 468 16998400
339596376 raghavendravelpugonda8 D Sept. 20, 2025, 5:12 p.m. OK Java 21 TESTS 21 483 16486400
339590585 pavitramalhotra160206 D Sept. 20, 2025, 4:55 p.m. OK Java 21 TESTS 21 499 17612800
339595928 ridham107 D Sept. 20, 2025, 5:10 p.m. OK Java 21 TESTS 21 562 21606400
339598799 habibulka D Sept. 20, 2025, 5:19 p.m. OK Java 21 TESTS 21 562 22016000
339631863 testtest111ksjfrdvn D Sept. 20, 2025, 9:50 p.m. OK Java 8 TESTS 21 328 19148800
339595684 harshchhallani3 D Sept. 20, 2025, 5:10 p.m. OK Java 8 TESTS 21 342 15564800
339632201 testtest111ksjfrdvn D Sept. 20, 2025, 9:55 p.m. OK Java 8 TESTS 21 343 19148800
339632035 testtest111ksjfrdvn D Sept. 20, 2025, 9:52 p.m. OK Java 8 TESTS 21 343 19148800
339602777 khemkaaditya48 D Sept. 20, 2025, 5:31 p.m. OK Java 8 TESTS 21 483 31334400
339632492 jatin310 D Sept. 20, 2025, 9:58 p.m. OK Java 8 TESTS 21 562 0
339591002 Raghvendra7415 D Sept. 20, 2025, 4:56 p.m. OK Java 8 TESTS 21 562 19968000
339624121 sarthaKKharKa_18 D Sept. 20, 2025, 8:20 p.m. OK Java 8 TESTS 21 577 18124800
339602565 teeac D Sept. 20, 2025, 5:30 p.m. OK Java 8 TESTS 21 639 18329600
339596824 div.mittal04 D Sept. 20, 2025, 5:13 p.m. OK Java 8 TESTS 21 984 22016000
339638771 Tlatoani D Sept. 21, 2025, 1:15 a.m. OK Kotlin 2.2 TESTS 21 343 18534400
339590017 practiceDaily25 D Sept. 20, 2025, 4:53 p.m. OK Node.js TESTS 21 453 73830400
339618736 shrigs03 D Sept. 20, 2025, 7:33 p.m. OK PyPy 3 TESTS 21 562 18944000
339617011 challavishweshwar D Sept. 20, 2025, 7:20 p.m. OK PyPy 3 TESTS 21 1093 28364800
339618910 Rudra_Dudhat D Sept. 20, 2025, 7:35 p.m. OK PyPy 3-64 TESTS 21 155 29388800
339633077 ebso D Sept. 20, 2025, 10:11 p.m. OK PyPy 3-64 TESTS 21 171 24678400
339639571 naniwazu D Sept. 21, 2025, 1:37 a.m. OK PyPy 3-64 TESTS 21 171 28672000
339614894 teekaytai D Sept. 20, 2025, 7:04 p.m. OK PyPy 3-64 TESTS 21 187 27033600
339636643 Maruzensky D Sept. 21, 2025, 12:06 a.m. OK PyPy 3-64 TESTS 21 187 34713600
339646180 Kaee D Sept. 21, 2025, 3:52 a.m. OK PyPy 3-64 TESTS 21 202 24678400
339642433 Mottchan123 D Sept. 21, 2025, 2:41 a.m. OK PyPy 3-64 TESTS 21 202 29593600
339632798 pierrot D Sept. 20, 2025, 10:05 p.m. OK PyPy 3-64 TESTS 21 202 30924800
339644404 young_skywalker_ D Sept. 21, 2025, 3:19 a.m. OK PyPy 3-64 TESTS 21 202 32051200
339651962 kau-shik D Sept. 21, 2025, 5:16 a.m. OK PyPy 3-64 TESTS 21 202 33177600
339647792 JAY_MANIYA_ D Sept. 21, 2025, 4:21 a.m. OK Python 3 TESTS 21 187 26726400
339652130 kjpeng314 D Sept. 21, 2025, 5:18 a.m. OK Python 3 TESTS 21 218 26726400
339611257 coderrg21 D Sept. 20, 2025, 6:43 p.m. OK Python 3 TESTS 21 389 31129600
339614403 ChatIsThisReal D Sept. 20, 2025, 7:01 p.m. OK Python 3 TESTS 21 749 67686400

remove filters

Back to search problems