Codeforces Round 1010 (Div. 1, Unrated)

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
2081 Codeforces Round 1010 (Div. 1, Unrated) FINISHED False 10800 34356323 March 15, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 4053 ) A Math Division PROGRAMMING bitmasks dp math probabilities

Ecrade has an integer (x). He will show you this number in the form of a binary number of length (n). There are two kinds of operations. Replace (x) with (\left\lfloor \dfrac{x}{2}\right\rfloor), where (\left\lfloor \dfrac{x}{2}\right\rfloor) is the greatest integer (\le \dfrac{x}{2}). Replace (x) with (\left\lceil \dfrac{x}{2}\right\rceil), where (\left\lceil \dfrac{x}{2}\right\rceil) is the smallest integer (\ge \dfrac{x}{2}). Ecrade will perform several operations until (x) becomes (1). Each time, he will independently choose to perform either the first operation or the second operation with probability (\frac{1}{2}). Ecrade wants to know the expected number of operations he will perform to make (x) equal to (1), modulo (10^9 + 7). However, it seems a little difficult, so please help him! The first line contains a single integer (t) ((1 \le t \le 10^5)) — 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 \le n \le 10^5)) — the length of (x) in binary representation. The second line of each test case contains a binary string of length (n): the number (x) in the binary representation, presented from the most significant bit to the least significant bit. It is guaranteed that the most significant bit of (x) is (1). It is guaranteed that the sum of (n) across all test cases does not exceed (10^5). For each test case, print a single integer representing the expected number of operations Ecrade will perform to make (x) equal to (1), modulo (10^9+7). Formally, let (M = 10^9+7). It can be shown that the exact answer can be expressed as an irreducible fraction (\frac{p}{q}), where (p) and (q) are integers and (q \not \equiv 0 \pmod{M}). Output the integer equal to (p \cdot q^{-1} \bmod M). In other words, output such an integer (x)

Tutorials

Codeforces Round 1010 (Div. 1, Div. 2, based on Zhili Cup 2025) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
310788580 Pew_Pew. A March 15, 2025, 7:30 p.m. OK C++17 (GCC 7-32) TESTS 14 46 0
310782204 himadri765 A March 15, 2025, 6:32 p.m. OK C++17 (GCC 7-32) TESTS 14 46 0
310824864 wshcl A March 16, 2025, 3:06 a.m. OK C++17 (GCC 7-32) TESTS 14 46 204800
310813077 Aiyaari A March 16, 2025, 1:22 a.m. OK C++17 (GCC 7-32) TESTS 14 61 0
310731565 potato167 A March 15, 2025, 2:39 p.m. OK C++17 (GCC 7-32) TESTS 14 61 0
310801396 Sparkle_Twilight A March 15, 2025, 9:45 p.m. OK C++17 (GCC 7-32) TESTS 14 61 102400
310798690 a_dev A March 15, 2025, 9:14 p.m. OK C++17 (GCC 7-32) TESTS 14 61 102400
310779749 kitsuna A March 15, 2025, 6:13 p.m. OK C++17 (GCC 7-32) TESTS 14 62 0
310747028 chief_27 A March 15, 2025, 3:22 p.m. OK C++17 (GCC 7-32) TESTS 14 62 0
310735592 hanuta A March 15, 2025, 2:47 p.m. OK C++17 (GCC 7-32) TESTS 14 62 0
310813155 cxm1024 A March 16, 2025, 1:24 a.m. OK C++20 (GCC 13-64) TESTS 14 46 0
310803458 kevinyang A March 15, 2025, 10:10 p.m. OK C++20 (GCC 13-64) TESTS 14 46 0
310791347 Bimbeso A March 15, 2025, 7:56 p.m. OK C++20 (GCC 13-64) TESTS 14 46 0
310743639 Noche_6 A March 15, 2025, 3:12 p.m. OK C++20 (GCC 13-64) TESTS 14 46 0
310824734 Brinton A March 16, 2025, 3:03 a.m. OK C++20 (GCC 13-64) TESTS 14 46 102400
310805812 enslaved A March 15, 2025, 10:46 p.m. OK C++20 (GCC 13-64) TESTS 14 46 102400
310782766 cockatooo_2025GM A March 15, 2025, 6:37 p.m. OK C++20 (GCC 13-64) TESTS 14 46 102400
310739375 A_G A March 15, 2025, 2:59 p.m. OK C++20 (GCC 13-64) TESTS 14 46 102400
310735423 natsugiri A March 15, 2025, 2:46 p.m. OK C++20 (GCC 13-64) TESTS 14 46 102400
310821634 dog_of_Nesraychan A March 16, 2025, 2:03 a.m. OK C++20 (GCC 13-64) TESTS 14 46 204800
310830614 LHaooo A March 16, 2025, 4:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 46 0
310823233 pb0207 A March 16, 2025, 2:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 46 0
310827561 Dby2dian A March 16, 2025, 3:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 46 102400
310812349 DeanMenezes93 A March 16, 2025, 1:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 46 102400
310780301 Yam A March 15, 2025, 6:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 46 102400
310735351 lcyxds A March 15, 2025, 2:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 46 102400
310780964 OTTFF A March 15, 2025, 6:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 61 0
310738053 _XVIIVX A March 15, 2025, 2:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 61 0
310735491 I.Gleb A March 15, 2025, 2:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 61 0
310732578 k1r1t0 A March 15, 2025, 2:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 61 0
310731489 hos.lyric A March 15, 2025, 2:39 p.m. OK D TESTS 14 77 2560000
310736421 pengin_2000 A March 15, 2025, 2:50 p.m. OK GNU C11 TESTS 14 62 204800
310784579 kl2400032885 A March 15, 2025, 6:53 p.m. OK GNU C11 TESTS 14 78 102400
310738333 pandeydevil0802 A March 15, 2025, 2:56 p.m. OK Java 21 TESTS 14 249 1228800
310774116 rakshit2611 A March 15, 2025, 5:28 p.m. OK Java 21 TESTS 14 280 204800
310749421 arnabmanna A March 15, 2025, 3:30 p.m. OK Java 21 TESTS 14 327 0
310731855 arvindf232 A March 15, 2025, 2:40 p.m. OK Kotlin 1.9 TESTS 14 328 1433600
310737144 Mukundan314 A March 15, 2025, 2:52 p.m. OK PyPy 3-64 TESTS 14 124 2252800
310779398 bronze_coder A March 15, 2025, 6:10 p.m. OK PyPy 3-64 TESTS 14 124 2764800
310731882 shikgom A March 15, 2025, 2:40 p.m. OK PyPy 3-64 TESTS 14 124 3174400
310731591 arindom001 A March 15, 2025, 2:39 p.m. OK PyPy 3-64 TESTS 14 124 3174400
310736829 tassei903 A March 15, 2025, 2:51 p.m. OK PyPy 3-64 TESTS 14 124 4403200
310745354 LMeyling A March 15, 2025, 3:17 p.m. OK PyPy 3-64 TESTS 14 139 2969600
310731655 golomb A March 15, 2025, 2:39 p.m. OK PyPy 3-64 TESTS 14 139 3481600
310798102 mahdi_mop A March 15, 2025, 9:07 p.m. OK PyPy 3-64 TESTS 14 140 2867200
310738130 Z_actuary A March 15, 2025, 2:55 p.m. OK PyPy 3-64 TESTS 14 140 12902400
310731352 bribritt A March 15, 2025, 2:38 p.m. OK PyPy 3-64 TESTS 14 186 2867200
310775014 Jimanbanashi A March 15, 2025, 5:33 p.m. OK Python 2 TESTS 14 171 0
310780340 galiver2009 A March 15, 2025, 6:17 p.m. OK Python 3 TESTS 14 109 3379200
310746466 VitalyKo A March 15, 2025, 3:20 p.m. OK Python 3 TESTS 14 124 0
310736640 Dpkasd_12 A March 15, 2025, 2:50 p.m. OK Rust 2021 TESTS 14 62 102400

remove filters

Back to search problems