Codeforces Round 951 (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
1979 Codeforces Round 951 (Div. 2) FINISHED False 7200 19495463 June 6, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 19396 ) C Earning on Bets PROGRAMMING binary search combinatorics constructive algorithms number theory

B'You have been offered to play a game. In this game, there are n possible outcomes, and for each of them, you must bet a certain integer amount of coins. In the event that the i -th outcome turns out to be winning, you will receive back the amount of coins equal to your bet on that outcome, multiplied by k_i . Note that exactly one of the n outcomes will be winning. Your task is to determine how to distribute the coins in such a way that you will come out ahead in the event of any winning outcome. More formally, the total amount of coins you bet on all outcomes must be strictly less than the number of coins received back for each possible winning outcome. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 50 ) -- the number of outcomes. The second line of each test case contains n integers k_1,k_2, ldots,k_n ( 2 <= k_i <= 20 ) -- the multiplier for the amount of coins if the i -th outcome turns out to be winning. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output -1 if there is no way to distribute the coins as required. Otherwise, output n integers x_1, x_2, ldots, x_n ( 1 <= x_i <= 10^{9} ) -- your bets on the outcomes. It can be shown that if a solution exists, there is always a solution that satisfies these constraints. If there are multiple suitable solutions, output any of them. In the first test case, the coins can be distributed as follows: 27 coins on the first outcome, 41 coins on the second outcome, 12 coins on the third outcome. Then the total amount of coins bet on all outcomes is 27 + 41 + 12 = 80 coins. If the first outcome turns out to be winning, you '...

Tutorials

Codeforces Round 951 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
264539130 qifan_maker C June 7, 2024, 4:40 a.m. OK C++14 (GCC 6-32) TESTS 12 77 1638400
264537480 llzer C June 7, 2024, 4:22 a.m. OK C++14 (GCC 6-32) TESTS 12 78 0
264533384 abcyz C June 7, 2024, 3:30 a.m. OK C++14 (GCC 6-32) TESTS 12 78 0
264527809 tdkbdbpvn C June 7, 2024, 2:08 a.m. OK C++14 (GCC 6-32) TESTS 12 78 0
264526407 tahoangquan2 C June 7, 2024, 1:41 a.m. OK C++14 (GCC 6-32) TESTS 12 78 0
264524542 somyapal111_ansh C June 7, 2024, 1 a.m. OK C++14 (GCC 6-32) TESTS 12 78 0
264508499 rithvick_2004 C June 6, 2024, 7:29 p.m. OK C++14 (GCC 6-32) TESTS 12 78 0
264501866 Norman165 C June 6, 2024, 6:19 p.m. OK C++14 (GCC 6-32) TESTS 12 78 0
264538995 qifan_maker C June 7, 2024, 4:38 a.m. OK C++14 (GCC 6-32) TESTS 12 78 1638400
264530164 ddl_yyds C June 7, 2024, 2:45 a.m. OK C++14 (GCC 6-32) TESTS 12 78 8089600
264530394 Drimpossible C June 7, 2024, 2:48 a.m. OK C++17 (GCC 7-32) TESTS 12 62 12288000
264543637 pkp245464 C June 7, 2024, 5:25 a.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264540127 .Miraitowa. C June 7, 2024, 4:50 a.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264526140 ashu_bhatta C June 7, 2024, 1:35 a.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264519249 vedant225411420 C June 6, 2024, 10:23 p.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264518654 D1orite C June 6, 2024, 10:07 p.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264514602 Bors__ C June 6, 2024, 8:50 p.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264511646 vashu123 C June 6, 2024, 8:08 p.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264511010 Mamun01 C June 6, 2024, 8 p.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264508013 DinoHadzic C June 6, 2024, 7:23 p.m. OK C++17 (GCC 7-32) TESTS 12 77 0
264526720 Floze3 C June 7, 2024, 1:48 a.m. OK C++20 (GCC 13-64) TESTS 12 61 204800
264542837 love_4ever C June 7, 2024, 5:17 a.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264542201 fs20091003 C June 7, 2024, 5:11 a.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264534465 AsadulloAbduev C June 7, 2024, 3:45 a.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264531516 markreisen C June 7, 2024, 3:04 a.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264527918 SunXiaoChuan C June 7, 2024, 2:09 a.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264527550 jackylova_fan_fan_fan C June 7, 2024, 2:03 a.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264526022 djm03178 C June 7, 2024, 1:33 a.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264524665 wenyalong C June 7, 2024, 1:03 a.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264498390 ashh18 C June 6, 2024, 5:51 p.m. OK C++20 (GCC 13-64) TESTS 12 62 0
264487104 fpccvn C June 6, 2024, 4:30 p.m. OK FPC TESTS 12 218 0
264535913 I_need_7.0_IELTS C June 7, 2024, 4:04 a.m. OK GNU C11 TESTS 12 624 102400
264494986 rishabh_sankla C June 6, 2024, 5:30 p.m. OK GNU C11 TESTS 12 639 102400
264502482 zhou.shi123 C June 6, 2024, 6:24 p.m. OK GNU C11 TESTS 12 656 102400
264488119 1435730 C June 6, 2024, 4:32 p.m. OK GNU C11 TESTS 12 671 102400
264532028 nguyenquocthao00 C June 7, 2024, 3:11 a.m. OK Go TESTS 12 108 5427200
264488493 ABHAY_DAGAR_IIITD C June 6, 2024, 4:33 p.m. OK Haskell TESTS 12 530 0
264536469 yang_wei C June 7, 2024, 4:11 a.m. OK Java 21 TESTS 12 296 716800
264485913 abusaeed2433 C June 6, 2024, 4:28 p.m. OK Java 21 TESTS 12 312 716800
264531850 Sven867 C June 7, 2024, 3:08 a.m. OK Java 21 TESTS 12 312 819200
264494270 Bhuwan_36 C June 6, 2024, 5:27 p.m. OK Java 21 TESTS 12 327 716800
264494807 vinay_panwar C June 6, 2024, 5:29 p.m. OK Java 21 TESTS 12 328 8908800
264512210 codeWithDarshan C June 6, 2024, 8:17 p.m. OK Java 21 TESTS 12 343 921600
264529325 Zhanzhe_Lee C June 7, 2024, 2:32 a.m. OK Java 21 TESTS 12 374 614400
264498455 himneesh9 C June 6, 2024, 5:52 p.m. OK Java 21 TESTS 12 374 921600
264530051 lyongwolf C June 7, 2024, 2:43 a.m. OK Java 21 TESTS 12 390 204800
264505993 OsamaNassar C June 6, 2024, 7 p.m. OK Java 21 TESTS 12 436 614400
264530235 harsh_1806 C June 7, 2024, 2:46 a.m. OK Java 8 TESTS 12 187 0
264492886 Blue_BEE C June 6, 2024, 5:20 p.m. OK Java 8 TESTS 12 187 0
264541800 harshitinfinix8 C June 7, 2024, 5:07 a.m. OK Java 8 TESTS 12 202 0
264499637 yadavDipesh C June 6, 2024, 6:01 p.m. OK Java 8 TESTS 12 202 0
264496723 Lakshay429 C June 6, 2024, 5:40 p.m. OK Java 8 TESTS 12 233 0
264500755 SweetAsCocaine C June 6, 2024, 6:10 p.m. OK Java 8 TESTS 12 281 0
264531417 achyut88 C June 7, 2024, 3:03 a.m. OK Java 8 TESTS 12 374 0
264542975 coderman2004 C June 7, 2024, 5:19 a.m. OK Java 8 TESTS 12 390 0
264517153 2manas1 C June 6, 2024, 9:35 p.m. OK Java 8 TESTS 12 514 0
264503870 DharmeshBangara C June 6, 2024, 6:37 p.m. OK Java 8 TESTS 12 531 0
264525365 y4n9b0 C June 7, 2024, 1:19 a.m. OK Kotlin 1.9 TESTS 12 265 204800
264525139 y4n9b0 C June 7, 2024, 1:14 a.m. OK Kotlin 1.9 TESTS 12 265 307200
264525884 y4n9b0 C June 7, 2024, 1:30 a.m. OK Kotlin 1.9 TESTS 12 280 204800
264510416 strategy C June 6, 2024, 7:53 p.m. OK PyPy 3 TESTS 12 281 9625600
264521824 wizardrabbit C June 6, 2024, 11:47 p.m. OK PyPy 3 TESTS 12 312 9523200
264493905 CallbackFunc C June 6, 2024, 5:25 p.m. OK PyPy 3 TESTS 12 484 9625600
264489841 chandak_devesh C June 6, 2024, 4:34 p.m. OK PyPy 3 TESTS 12 531 9728000
264530790 hxu10 C June 7, 2024, 2:54 a.m. OK PyPy 3-64 TESTS 12 140 8089600
264498036 Om_Singh_ C June 6, 2024, 5:49 p.m. OK PyPy 3-64 TESTS 12 156 5324800
264498201 deni1000 C June 6, 2024, 5:50 p.m. OK PyPy 3-64 TESTS 12 171 5120000
264532532 yefei162 C June 7, 2024, 3:18 a.m. OK PyPy 3-64 TESTS 12 171 6144000
264499576 Ati_Awesome1 C June 6, 2024, 6:01 p.m. OK PyPy 3-64 TESTS 12 171 6553600
264485798 woojin1354 C June 6, 2024, 4:28 p.m. OK PyPy 3-64 TESTS 12 171 8294400
264535442 broshen C June 7, 2024, 3:57 a.m. OK PyPy 3-64 TESTS 12 171 8396800
264505161 RobinFromTheHood C June 6, 2024, 6:51 p.m. OK PyPy 3-64 TESTS 12 171 8396800
264540122 luogu_bot2 C June 7, 2024, 4:50 a.m. OK PyPy 3-64 TESTS 12 171 8499200
264525794 MdAbedin C June 7, 2024, 1:28 a.m. OK PyPy 3-64 TESTS 12 171 8806400
264534750 Asfak_Shahrier C June 7, 2024, 3:49 a.m. OK Python 3 TESTS 12 202 0
264513123 connorencrypted C June 6, 2024, 8:31 p.m. OK Python 3 TESTS 12 218 0
264519275 hsr_69 C June 6, 2024, 10:24 p.m. OK Python 3 TESTS 12 233 0
264488149 seeforty4040 C June 6, 2024, 4:32 p.m. OK Python 3 TESTS 12 249 0
264494374 ok12 C June 6, 2024, 5:27 p.m. OK Python 3 TESTS 12 250 0
264508002 Nishant__Ranjan C June 6, 2024, 7:23 p.m. OK Python 3 TESTS 12 265 0
264505229 anna16 C June 6, 2024, 6:52 p.m. OK Python 3 TESTS 12 265 0
264509055 Rogue_Ningen C June 6, 2024, 7:36 p.m. OK Python 3 TESTS 12 265 307200
264538875 Akshat8619 C June 7, 2024, 4:37 a.m. OK Python 3 TESTS 12 265 3174400
264494922 gluestick12 C June 6, 2024, 5:30 p.m. OK Python 3 TESTS 12 265 22425600
264522427 PlaceOrientedProgrammer C June 7, 2024, 12:06 a.m. OK Rust 2021 TESTS 12 77 0
264515334 atamakahere C June 6, 2024, 9:02 p.m. OK Rust 2021 TESTS 12 77 0
264508706 vstiff C June 6, 2024, 7:32 p.m. OK Rust 2021 TESTS 12 77 0
264500993 fieubat2x C June 6, 2024, 6:12 p.m. OK Rust 2021 TESTS 12 109 0

remove filters

Back to search problems