Codeforces Round 839 (Div. 3)

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
1772 Codeforces Round 839 (Div. 3) FINISHED False 8100 65805863 Dec. 18, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1425 ) G Gaining Rating PROGRAMMING binary search greedy math sortings

B"Monocarp is playing chess on one popular website. He has n opponents he can play with. The i -th opponent has rating equal to a_i . Monocarp's initial rating is x . Monocarp wants to raise his rating to the value y ( y > x ). When Monocarp is playing against one of the opponents, he will win if his current rating is bigger or equal to the opponent's rating. If Monocarp wins, his rating is increased by 1 , otherwise it is decreased by 1 . The rating of his opponent does not change. Monocarp wants to gain rating y playing as few games as possible. But he can't just grind it, playing against weak opponents. The website has a rule that you should play against all opponents as evenly as possible. Speaking formally, if Monocarp wants to play against an opponent i , there should be no other opponent j such that Monocarp has played more games against i than against j . Calculate the minimum possible number of games Monocarp needs to gain rating y or say it's impossible. Note that ratings of Monocarp's opponents don't change, while Monocarp's rating does change. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains three integers n , x and y ( 1 <= n <= 2 cdot 10^5 ; 1 <= x < y <= 10^{12} ) -- the number of Monocarp's opponents, his initial and desired ratings. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^{12} ) -- ratings of Monocarp's opponents. Additional constraint on the input: the total sum of n over all t test cases doesn't exceed 2 cdot 10^5 . For each test case, print a single integer -- the minimum number of games Monocarp needs to play to gain rating y , or -1 if it's impossible. In the first test case, Monocarp can use the following strategy: In the second test case, it can be"...

Tutorials

110313

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
186044903 mban259 G Dec. 19, 2022, 9:44 p.m. OK C# 10 TESTS 21 108 29696000
186032898 PhoenixBird G Dec. 19, 2022, 6:57 p.m. OK GNU C++14 TESTS 21 78 1638400
185915174 Pain_373 G Dec. 19, 2022, 6:36 a.m. OK GNU C++14 TESTS 21 78 1638400
185942726 Aurora- G Dec. 19, 2022, 11:45 a.m. OK GNU C++14 TESTS 21 78 3174400
185933772 KirimaSyaro G Dec. 19, 2022, 10:10 a.m. OK GNU C++14 TESTS 21 92 4812800
185957244 Prasanna_Jangali G Dec. 19, 2022, 2:04 p.m. OK GNU C++14 TESTS 21 93 1638400
185955809 SergiiGolovko G Dec. 19, 2022, 1:51 p.m. OK GNU C++14 TESTS 21 93 1638400
185922060 itz_archit G Dec. 19, 2022, 7:56 a.m. OK GNU C++14 TESTS 21 93 1638400
185903805 prairie2022 G Dec. 19, 2022, 3:06 a.m. OK GNU C++14 TESTS 21 93 1638400
185914318 quanjun G Dec. 19, 2022, 6:25 a.m. OK GNU C++14 TESTS 21 93 1945600
185942854 Aurora- G Dec. 19, 2022, 11:46 a.m. OK GNU C++14 TESTS 21 93 3174400
185886022 MA7887 G Dec. 18, 2022, 7:18 p.m. OK GNU C++17 TESTS 21 78 1638400
185939960 TESTdumb G Dec. 19, 2022, 11:16 a.m. OK GNU C++17 TESTS 21 78 3174400
185956942 Suru007 G Dec. 19, 2022, 2:02 p.m. OK GNU C++17 TESTS 21 93 1638400
185952125 shdut0901 G Dec. 19, 2022, 1:17 p.m. OK GNU C++17 TESTS 21 93 1638400
185947989 Vaibhav_Kumar G Dec. 19, 2022, 12:38 p.m. OK GNU C++17 TESTS 21 93 1638400
185943240 harshpatil2104 G Dec. 19, 2022, 11:50 a.m. OK GNU C++17 TESTS 21 93 1638400
185943103 harshpatil2104 G Dec. 19, 2022, 11:49 a.m. OK GNU C++17 TESTS 21 93 1638400
185924051 JellyBoi G Dec. 19, 2022, 8:20 a.m. OK GNU C++17 TESTS 21 93 1638400
185918226 PooniaPankaj07 G Dec. 19, 2022, 7:11 a.m. OK GNU C++17 TESTS 21 93 1638400
185918188 b21111 G Dec. 19, 2022, 7:11 a.m. OK GNU C++17 TESTS 21 93 1638400
185898334 pd_codes G Dec. 18, 2022, 11:53 p.m. OK GNU C++17 (64) TESTS 21 46 1638400
185894264 bashkort G Dec. 18, 2022, 9:37 p.m. OK GNU C++17 (64) TESTS 21 46 1638400
185950287 lgxyes G Dec. 19, 2022, 12:59 p.m. OK GNU C++17 (64) TESTS 21 61 1638400
185888072 slongle G Dec. 18, 2022, 7:48 p.m. OK GNU C++17 (64) TESTS 21 61 1638400
185956182 MohamedAboOkail G Dec. 19, 2022, 1:54 p.m. OK GNU C++17 (64) TESTS 21 62 1638400
185898230 Light_KG G Dec. 18, 2022, 11:48 p.m. OK GNU C++17 (64) TESTS 21 62 1638400
186040360 Livu_sz G Dec. 19, 2022, 8:17 p.m. OK GNU C++17 (64) TESTS 21 62 4812800
186040220 Livu_sz G Dec. 19, 2022, 8:15 p.m. OK GNU C++17 (64) TESTS 21 62 4812800
186037844 Livu_sz G Dec. 19, 2022, 7:46 p.m. OK GNU C++17 (64) TESTS 21 62 4812800
185914119 illume2021 G Dec. 19, 2022, 6:22 a.m. OK GNU C++17 (64) TESTS 21 62 7987200
185907581 CLT G Dec. 19, 2022, 4:29 a.m. OK GNU C++20 (64) TESTS 21 31 5222400
186063348 AbdalrhmanEssam G Dec. 20, 2022, 5:20 a.m. OK GNU C++20 (64) TESTS 21 46 1638400
186040155 HarryJPotter G Dec. 19, 2022, 8:14 p.m. OK GNU C++20 (64) TESTS 21 46 1638400
186030557 brenner1 G Dec. 19, 2022, 6:38 p.m. OK GNU C++20 (64) TESTS 21 46 1638400
186023789 nizamoff G Dec. 19, 2022, 5:48 p.m. OK GNU C++20 (64) TESTS 21 46 1638400
186017616 TimDee G Dec. 19, 2022, 5:12 p.m. OK GNU C++20 (64) TESTS 21 46 1638400
185994846 XiCen G Dec. 19, 2022, 3:51 p.m. OK GNU C++20 (64) TESTS 21 46 1638400
185968355 mdshadesh G Dec. 19, 2022, 2:51 p.m. OK GNU C++20 (64) TESTS 21 46 1638400
185959497 Kidding_M G Dec. 19, 2022, 2:24 p.m. OK GNU C++20 (64) TESTS 21 46 1638400
185953726 fairy_land G Dec. 19, 2022, 1:31 p.m. OK GNU C++20 (64) TESTS 21 46 1638400
185898288 profchi G Dec. 18, 2022, 11:50 p.m. OK Java 11 TESTS 21 342 3993600
185880670 NerfThis G Dec. 18, 2022, 5:58 p.m. OK Java 8 TESTS 21 280 12902400
185934244 timusmanovs G Dec. 19, 2022, 10:15 a.m. OK MS C++ 2017 TESTS 21 234 1638400
185884792 sushmanth.dampur8780 G Dec. 18, 2022, 7:02 p.m. OK PyPy 3-64 TESTS 21 217 27136000
185898928 biglunchdude G Dec. 19, 2022, 12:20 a.m. OK PyPy 3-64 TESTS 21 218 27033600
185884772 sushmanth.dampur8780 G Dec. 18, 2022, 7:02 p.m. OK PyPy 3-64 TESTS 21 233 27136000
185898458 biglunchdude G Dec. 18, 2022, 11:58 p.m. OK PyPy 3-64 TESTS 21 296 27545600
185907931 onemoreq G Dec. 19, 2022, 4:35 a.m. OK PyPy 3-64 TESTS 21 373 27340800
185886306 Ayushrusiya47 G Dec. 18, 2022, 7:22 p.m. OK PyPy 3-64 TESTS 21 374 27545600
185887091 Ayushrusiya47 G Dec. 18, 2022, 7:34 p.m. OK PyPy 3-64 TESTS 21 389 27648000
185881390 synthplicity G Dec. 18, 2022, 6:11 p.m. OK PyPy 3-64 TESTS 21 390 26419200
185931303 horrlod G Dec. 19, 2022, 9:42 a.m. OK PyPy 3-64 TESTS 21 997 27033600
185880716 kartikdk G Dec. 18, 2022, 5:59 p.m. OK Python 3 TESTS 21 358 17203200
186055658 hkwu6013 G Dec. 20, 2022, 3:11 a.m. OK Python 3 TESTS 21 467 19251200
185886480 wmrmr G Dec. 18, 2022, 7:25 p.m. OK Rust 2021 TESTS 21 31 8908800
185906625 Sempr G Dec. 19, 2022, 4:11 a.m. OK Rust 2021 TESTS 21 46 7680000
185909822 xxafhixx G Dec. 19, 2022, 5:10 a.m. OK Rust 2021 TESTS 21 46 18534400

remove filters

Back to search problems