Codeforces Round 1072 (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
2184 Codeforces Round 1072 (Div. 3) FINISHED False 8100 8177123 Jan. 12, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 9343 ) D Unfair Game PROGRAMMING combinatorics dp math

Bob is tired of losing to Alice and, to ensure he doesn't lose again, decided to choose a game in which he is guaranteed to win. Bob has thought of a number from (1) to (n), where it is known that (n = 2^d) for some non-negative integer (d). Initially, Alice knows whether the chosen number is even or not. In one move, Alice can either halve the number or subtract (1). Alice can only halve the number if the current number is even. Only Alice takes turns. After her move, Alice receives a response from Bob: either (-1), which means the number has become (0) and Alice has won, or a non-negative integer (x). If we denote the current number as (a), then for (x) the following conditions hold simultaneously: (a) is divisible by (2^x). (a) is not divisible by (2^{x+1}). For example, if (a=5), then (x=0), since (5) is divisible by (2^0=1) and not divisible by (2^1=2), and if (a=12), then (x=2), since (12) is divisible by (2^2=4) and not divisible by (2^3=8). It can be shown that for any integer (a > 0), there exists a unique such (x). Bob is still afraid that Alice will win, so the game will have no more than (k) moves. Additionally, Bob wants to maximize his chances of winning, so he wants to play as many games as possible. Given (n) and (k), calculate the number of initial numbers from (1) to (n) such that Alice, playing optimally, cannot win in no more than (k) moves. The first line contains an integer (t) ((1 \le t \le 10^4)) — the number of test cases. The only line of each test case contains (2) integers (n) and (k) ((1 \le n, k \le 10^9)) — the limit on the chosen number and the maximum number of Alice's moves, respectively. It is guaranteed that (n = 2^d) for some non-negative integer (d). For each test case, output the number of integers from (1) to (n) such that Alice, playing optimally, can

Tutorials

Codeforces Round 1072 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
357708655 samyak2004 D Jan. 13, 2026, 1:45 p.m. OK C++17 (GCC 7-32) TESTS 19 31 0
357716493 Gauss28 D Jan. 13, 2026, 2:42 p.m. OK C++17 (GCC 7-32) TESTS 19 31 102400
357682634 nab_002 D Jan. 13, 2026, 10:12 a.m. OK C++17 (GCC 7-32) TESTS 19 31 102400
357653690 anonymous_17 D Jan. 13, 2026, 4:55 a.m. OK C++17 (GCC 7-32) TESTS 19 31 102400
357686179 m.pb2 D Jan. 13, 2026, 10:45 a.m. OK C++17 (GCC 7-32) TESTS 19 31 7372800
357765101 Goolu D Jan. 13, 2026, 9:38 p.m. OK C++17 (GCC 7-32) TESTS 19 46 0
357762916 TMSniper D Jan. 13, 2026, 8:52 p.m. OK C++17 (GCC 7-32) TESTS 19 46 0
357760139 HopefulSpecialist D Jan. 13, 2026, 8:08 p.m. OK C++17 (GCC 7-32) TESTS 19 46 0
357748347 Divy_8745 D Jan. 13, 2026, 6:20 p.m. OK C++17 (GCC 7-32) TESTS 19 46 0
357747215 Dobby_Code D Jan. 13, 2026, 6:13 p.m. OK C++17 (GCC 7-32) TESTS 19 46 0
357730529 Toronto.Tokyo D Jan. 13, 2026, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 19 31 102400
357728116 aviate D Jan. 13, 2026, 4:12 p.m. OK C++20 (GCC 13-64) TESTS 19 31 102400
357696248 Jahid__Noob D Jan. 13, 2026, 12:10 p.m. OK C++20 (GCC 13-64) TESTS 19 31 102400
357784198 not_from_iit_d D Jan. 14, 2026, 5:39 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
357783273 sadnessnsorrow D Jan. 14, 2026, 5:26 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
357781977 Jteh D Jan. 14, 2026, 5:07 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
357764883 Panther D Jan. 13, 2026, 9:33 p.m. OK C++20 (GCC 13-64) TESTS 19 46 0
357752052 yojit.k D Jan. 13, 2026, 6:47 p.m. OK C++20 (GCC 13-64) TESTS 19 46 0
357747377 valor_1 D Jan. 13, 2026, 6:14 p.m. OK C++20 (GCC 13-64) TESTS 19 46 0
357744237 sonthaliyap D Jan. 13, 2026, 5:55 p.m. OK C++20 (GCC 13-64) TESTS 19 46 0
357775859 CN_Hoang D Jan. 14, 2026, 3:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 0
357695406 4ankit_raj9 D Jan. 13, 2026, 12:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 0
357689260 bsn666 D Jan. 13, 2026, 11:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 0
357656465 1618s3 D Jan. 13, 2026, 5:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 0
357768594 thekmman D Jan. 13, 2026, 11:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 102400
357758606 becastal D Jan. 13, 2026, 7:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 102400
357757555 Hany_Osama D Jan. 13, 2026, 7:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 102400
357749448 hexhunter06 D Jan. 13, 2026, 6:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 102400
357714948 lazyflash99 D Jan. 13, 2026, 2:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 102400
357710389 MakaNehith14 D Jan. 13, 2026, 1:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 102400
357719241 ruban D Jan. 13, 2026, 3:04 p.m. OK FPC TESTS 19 93 9830400
357784485 Leeeee D Jan. 14, 2026, 5:43 a.m. OK Go TESTS 19 46 512000
357675648 567jiong D Jan. 13, 2026, 9:13 a.m. OK Go TESTS 19 62 819200
357674301 567jiong D Jan. 13, 2026, 9 a.m. OK Go TESTS 19 62 819200
357656620 LittleGopher D Jan. 13, 2026, 5:33 a.m. OK Go TESTS 19 156 4403200
357743600 VivirAstucia D Jan. 13, 2026, 5:51 p.m. OK Haskell TESTS 19 171 102400
357786768 _ameysawant_ D Jan. 14, 2026, 6:10 a.m. OK Java 21 TESTS 19 203 1638400
357766832 pcmeena511 D Jan. 13, 2026, 10:29 p.m. OK Java 21 TESTS 19 234 409600
357778201 cpp10 D Jan. 14, 2026, 4:03 a.m. OK Java 21 TESTS 19 234 614400
357701364 madhanirahul92 D Jan. 13, 2026, 12:52 p.m. OK Java 21 TESTS 19 234 716800
357685653 UlianaKhodaeva D Jan. 13, 2026, 10:41 a.m. OK Java 21 TESTS 19 250 716800
357718118 SathvikGoud D Jan. 13, 2026, 2:55 p.m. OK Java 21 TESTS 19 250 2048000
357778131 cpp10 D Jan. 14, 2026, 4:02 a.m. OK Java 21 TESTS 19 265 1024000
357710122 sulabhambule D Jan. 13, 2026, 1:55 p.m. OK Java 21 TESTS 19 265 1024000
357754161 Aaditya01Sehgal D Jan. 13, 2026, 7:05 p.m. OK Java 21 TESTS 19 296 1638400
357685887 jaxxnitt D Jan. 13, 2026, 10:43 a.m. OK Java 21 TESTS 19 312 1331200
357746162 abhi... D Jan. 13, 2026, 6:06 p.m. OK Java 8 TESTS 19 125 0
357725921 Picklzes D Jan. 13, 2026, 3:57 p.m. OK Java 8 TESTS 19 375 0
357765453 arvindf232 D Jan. 13, 2026, 9:48 p.m. OK Kotlin 2.2 TESTS 19 218 24678400
357673920 chennaiMetroOP D Jan. 13, 2026, 8:56 a.m. OK PyPy 3 TESTS 19 953 7680000
357675887 chennaiMetroOP D Jan. 13, 2026, 9:15 a.m. OK PyPy 3 TESTS 19 984 9113600
357709941 Ayushman_123 D Jan. 13, 2026, 1:54 p.m. OK PyPy 3 TESTS 19 984 9728000
357702949 Eigen_Vector D Jan. 13, 2026, 1:03 p.m. OK PyPy 3-64 TESTS 19 109 3891200
357701739 Eigen_Vector D Jan. 13, 2026, 12:54 p.m. OK PyPy 3-64 TESTS 19 109 3993600
357707341 bhargav_kikani D Jan. 13, 2026, 1:36 p.m. OK PyPy 3-64 TESTS 19 125 3072000
357747401 the_anchor_being D Jan. 13, 2026, 6:14 p.m. OK PyPy 3-64 TESTS 19 125 3276800
357707548 bhargav_kikani D Jan. 13, 2026, 1:38 p.m. OK PyPy 3-64 TESTS 19 125 4096000
357703411 Eigen_Vector D Jan. 13, 2026, 1:07 p.m. OK PyPy 3-64 TESTS 19 125 4198400
357767264 zuba37 D Jan. 13, 2026, 10:45 p.m. OK PyPy 3-64 TESTS 19 125 4403200
357687978 jagannathpisharody D Jan. 13, 2026, 11 a.m. OK PyPy 3-64 TESTS 19 140 4608000
357686929 gardengnome D Jan. 13, 2026, 10:52 a.m. OK PyPy 3-64 TESTS 19 140 4608000
357697489 HumbleRobo D Jan. 13, 2026, 12:21 p.m. OK PyPy 3-64 TESTS 19 140 5017600
357722489 22pa1a05f9 D Jan. 13, 2026, 3:31 p.m. OK Python 3 TESTS 19 312 2969600
357703192 Eigen_Vector D Jan. 13, 2026, 1:05 p.m. OK Python 3 TESTS 19 515 307200
357739548 joneswilliamaa D Jan. 13, 2026, 5:26 p.m. OK Python 3 TESTS 19 562 307200
357777593 hundunlilun1 D Jan. 14, 2026, 3:52 a.m. OK Python 3 TESTS 19 578 102400
357753890 kushagra2468 D Jan. 13, 2026, 7:03 p.m. OK Python 3 TESTS 19 593 102400
357703021 Eigen_Vector D Jan. 13, 2026, 1:04 p.m. OK Python 3 TESTS 19 734 204800
357756420 rakshit__modi D Jan. 13, 2026, 7:25 p.m. OK Python 3 TESTS 19 812 204800
357700339 Eigen_Vector D Jan. 13, 2026, 12:44 p.m. OK Python 3 TESTS 19 859 204800
357673349 MihailLoginov D Jan. 13, 2026, 8:52 a.m. OK Python 3 TESTS 19 875 409600
357731058 GUAIKATTO D Jan. 13, 2026, 4:32 p.m. OK Rust 2024 TESTS 19 46 13414400
357709063 Yoda1122 D Jan. 13, 2026, 1:48 p.m. OK Rust 2024 TESTS 19 93 0
357773907 hirose2020 D Jan. 14, 2026, 2:38 a.m. OK Rust 2024 TESTS 19 109 11776000
357773608 _JG_ D Jan. 14, 2026, 2:30 a.m. OK Rust 2024 TESTS 19 125 0
357773572 _JG_ D Jan. 14, 2026, 2:29 a.m. OK Rust 2024 TESTS 19 156 11776000

remove filters

Back to search problems