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 |
---|---|---|---|---|---|---|
1884 | Codeforces Round 904 (Div. 2) | FINISHED | False | 7200 | 39221663 | Oct. 22, 2023, 7:05 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 13007 ) | B | Haunted House | PROGRAMMING | greedy math two pointers |
B"You are given a number in binary representation consisting of exactly n bits, possibly, with leading zeroes. For example, for n = 5 the number 6 will be given as 00110 , and for n = 4 the number 9 will be given as 1001 . Let's fix some integer i such that 1 <= i <= n . In one operation you can swap any two adjacent bits in the binary representation. Your goal is to find the smallest number of operations you are required to perform to make the number divisible by 2^i , or say that it is impossible. Please note that for each 1 <= i <= n you are solving the problem independently. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. The first line of each test case contains one integer n ( 1 <= n <= 10^5 ) -- the length of the binary representation of the number. The second line of each test case contains a string of length n , consisting of 0 and 1 , -- the binary representation of the number. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, for each 1 <= i <= n output the smallest number of operations required to make the number divisible by 2^i , or output -1 if it is impossible. In the first test case, we cannot swap any elements, and the number 1 is not divisible by 2 . In the second test case, the initial number is 1 . It is not divisible by 2 , but if we perform the operation, then we obtain the number with binary representation 10 , which is equal to 2 in decimal representation, thus, it is divisible by 2 . But this number is not divisible by 4 and we cannot obtain any other number using the operations. In the third test case, the initial number is 2 . For i = 1 we do not have to perform any operations sinc"... |
Codeforces Round #904 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
229200308 | JingLiu | B | Oct. 22, 2023, 10:31 a.m. | OK | Clang++20 Diagnostics | TESTS | 11 | 748 | 921600 | ||
229372379 | mother9532793815 | B | Oct. 23, 2023, 5:38 a.m. | OK | Clang++20 Diagnostics | TESTS | 11 | 826 | 26726400 | ||
229197586 | JingLiu | B | Oct. 22, 2023, 10:07 a.m. | OK | Clang++20 Diagnostics | TESTS | 11 | 842 | 921600 | ||
229180641 | 1435730 | B | Oct. 22, 2023, 8:33 a.m. | OK | GNU C11 | TESTS | 11 | 31 | 204800 | ||
229191836 | iffatul_anon | B | Oct. 22, 2023, 9:24 a.m. | OK | GNU C11 | TESTS | 11 | 873 | 921600 | ||
229179422 | Karan_14 | B | Oct. 22, 2023, 8:29 a.m. | OK | GNU C11 | TESTS | 11 | 889 | 512000 | ||
229177534 | 3inf | B | Oct. 22, 2023, 8:22 a.m. | OK | GNU C++14 | TESTS | 11 | 31 | 1024000 | ||
229187971 | NewTraveller | B | Oct. 22, 2023, 9 a.m. | OK | GNU C++14 | TESTS | 11 | 31 | 1638400 | ||
229362569 | lhy123 | B | Oct. 23, 2023, 3 a.m. | OK | GNU C++14 | TESTS | 11 | 31 | 3072000 | ||
229188419 | Estelle. | B | Oct. 22, 2023, 9:02 a.m. | OK | GNU C++14 | TESTS | 11 | 46 | 102400 | ||
229181322 | zhdzh | B | Oct. 22, 2023, 8:36 a.m. | OK | GNU C++14 | TESTS | 11 | 46 | 102400 | ||
229189316 | xrenenena | B | Oct. 22, 2023, 9:04 a.m. | OK | GNU C++14 | TESTS | 11 | 46 | 102400 | ||
229176090 | hdhy | B | Oct. 22, 2023, 8:17 a.m. | OK | GNU C++14 | TESTS | 11 | 46 | 204800 | ||
229175054 | WXYZ23242526 | B | Oct. 22, 2023, 8:14 a.m. | OK | GNU C++14 | TESTS | 11 | 46 | 204800 | ||
229302949 | kuguadawang | B | Oct. 22, 2023, 2:42 p.m. | OK | GNU C++14 | TESTS | 11 | 46 | 409600 | ||
229329336 | sachin_53 | B | Oct. 22, 2023, 6:22 p.m. | OK | GNU C++14 | TESTS | 11 | 46 | 409600 | ||
229374409 | wkx | B | Oct. 23, 2023, 6 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 102400 | ||
229181880 | clc26765 | B | Oct. 22, 2023, 8:38 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 102400 | ||
229180344 | repugnant | B | Oct. 22, 2023, 8:32 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 102400 | ||
229358652 | Lucky7 | B | Oct. 23, 2023, 1:40 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 204800 | ||
229177170 | wikolego | B | Oct. 22, 2023, 8:21 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 204800 | ||
229352522 | Beautiful_Times | B | Oct. 22, 2023, 10:37 p.m. | OK | GNU C++17 | TESTS | 11 | 46 | 307200 | ||
229179650 | username918q818 | B | Oct. 22, 2023, 8:30 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 307200 | ||
229367834 | yousseff125 | B | Oct. 23, 2023, 4:35 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 409600 | ||
229349272 | mrbodi555 | B | Oct. 22, 2023, 9:36 p.m. | OK | GNU C++17 | TESTS | 11 | 46 | 409600 | ||
229372970 | hthai1306 | B | Oct. 23, 2023, 5:45 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 409600 | ||
229196859 | BODH | B | Oct. 22, 2023, 10:01 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 30 | 307200 | ||
229172754 | daud04 | B | Oct. 22, 2023, 8:07 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 30 | 2355200 | ||
229355471 | nyyjshcz | B | Oct. 23, 2023, 12:14 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 102400 | ||
229198744 | BODH | B | Oct. 22, 2023, 10:18 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 307200 | ||
229173020 | bblyyds | B | Oct. 22, 2023, 8:08 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 307200 | ||
229270274 | BODH | B | Oct. 22, 2023, 12:37 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 307200 | ||
229266245 | BODH | B | Oct. 22, 2023, 12:30 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 307200 | ||
229198805 | BODH | B | Oct. 22, 2023, 10:18 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 307200 | ||
229197388 | BODH | B | Oct. 22, 2023, 10:05 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 409600 | ||
229341202 | GalacticDragon | B | Oct. 22, 2023, 8:28 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 409600 | ||
229294881 | Tadashii | B | Oct. 22, 2023, 1:56 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 307200 | ||
229298756 | yinnierfei | B | Oct. 22, 2023, 2:15 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 307200 | ||
229194881 | X_01 | B | Oct. 22, 2023, 9:45 a.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 307200 | ||
229185214 | m_yousuf123 | B | Oct. 22, 2023, 8:50 a.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 307200 | ||
229178999 | windinwait | B | Oct. 22, 2023, 8:27 a.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 307200 | ||
229191861 | siiiuuu | B | Oct. 22, 2023, 9:24 a.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 512000 | ||
229192006 | sam990 | B | Oct. 22, 2023, 9:25 a.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 1024000 | ||
229191802 | Xx-mdsa-xX | B | Oct. 22, 2023, 9:24 a.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 1024000 | ||
229201474 | heowk | B | Oct. 22, 2023, 10:42 a.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 1024000 | ||
229303490 | AbdullahFarg | B | Oct. 22, 2023, 2:46 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 15 | 1024000 | ||
229176949 | katomasao | B | Oct. 22, 2023, 8:20 a.m. | OK | Haskell | TESTS | 11 | 171 | 19968000 | ||
229181615 | man-ray | B | Oct. 22, 2023, 8:37 a.m. | OK | Java 11 | TESTS | 11 | 233 | 0 | ||
229173555 | powervic08 | B | Oct. 22, 2023, 8:09 a.m. | OK | Java 11 | TESTS | 11 | 233 | 0 | ||
229172956 | barbar1k | B | Oct. 22, 2023, 8:07 a.m. | OK | Java 11 | TESTS | 11 | 249 | 0 | ||
229186656 | piyush_16 | B | Oct. 22, 2023, 8:56 a.m. | OK | Java 11 | TESTS | 11 | 264 | 0 | ||
229176115 | _.aadi01 | B | Oct. 22, 2023, 8:18 a.m. | OK | Java 11 | TESTS | 11 | 264 | 40550400 | ||
229203822 | RahulAhuja2901 | B | Oct. 22, 2023, 11:05 a.m. | OK | Java 11 | TESTS | 11 | 280 | 0 | ||
229193984 | Pranav_Sharda | B | Oct. 22, 2023, 9:39 a.m. | OK | Java 11 | TESTS | 11 | 280 | 0 | ||
229179275 | kkumarr1250 | B | Oct. 22, 2023, 8:28 a.m. | OK | Java 11 | TESTS | 11 | 280 | 204800 | ||
229194187 | prajwaldhule36 | B | Oct. 22, 2023, 9:40 a.m. | OK | Java 11 | TESTS | 11 | 296 | 307200 | ||
229172997 | HarshitShukla__ | B | Oct. 22, 2023, 8:08 a.m. | OK | Java 11 | TESTS | 11 | 311 | 0 | ||
229178115 | KAZHYI | B | Oct. 22, 2023, 8:24 a.m. | OK | Java 17 | TESTS | 11 | 264 | 0 | ||
229201967 | KIRA_p01 | B | Oct. 22, 2023, 10:47 a.m. | OK | Java 17 | TESTS | 11 | 280 | 409600 | ||
229293967 | vikasseervi357 | B | Oct. 22, 2023, 1:52 p.m. | OK | Java 17 | TESTS | 11 | 280 | 716800 | ||
229193682 | vikasseervi357 | B | Oct. 22, 2023, 9:36 a.m. | OK | Java 17 | TESTS | 11 | 280 | 921600 | ||
229174288 | prac_123 | B | Oct. 22, 2023, 8:12 a.m. | OK | Java 17 | TESTS | 11 | 295 | 409600 | ||
229177102 | Ganesha_ | B | Oct. 22, 2023, 8:21 a.m. | OK | Java 17 | TESTS | 11 | 296 | 307200 | ||
229185665 | mo_heat | B | Oct. 22, 2023, 8:52 a.m. | OK | Java 17 | TESTS | 11 | 312 | 614400 | ||
229191765 | AKhacks | B | Oct. 22, 2023, 9:24 a.m. | OK | Java 17 | TESTS | 11 | 327 | 102400 | ||
229194889 | codeanand17 | B | Oct. 22, 2023, 9:45 a.m. | OK | Java 17 | TESTS | 11 | 342 | 1536000 | ||
229187480 | aniketgupta06 | B | Oct. 22, 2023, 8:59 a.m. | OK | Java 17 | TESTS | 11 | 358 | 1843200 | ||
229184649 | Akash_Sardar | B | Oct. 22, 2023, 8:48 a.m. | OK | Java 21 | TESTS | 11 | 280 | 0 | ||
229175529 | atharvabanasure | B | Oct. 22, 2023, 8:16 a.m. | OK | Java 21 | TESTS | 11 | 342 | 0 | ||
229203645 | Sindy | B | Oct. 22, 2023, 11:03 a.m. | OK | Java 21 | TESTS | 11 | 670 | 0 | ||
229181909 | saksham294 | B | Oct. 22, 2023, 8:38 a.m. | OK | Java 21 | TESTS | 11 | 919 | 0 | ||
229181453 | Yevsieiev_Mykyta | B | Oct. 22, 2023, 8:36 a.m. | OK | Java 21 | TESTS | 11 | 935 | 204800 | ||
229178685 | Ronak_Ramuka | B | Oct. 22, 2023, 8:26 a.m. | OK | Java 21 | TESTS | 11 | 951 | 0 | ||
229177139 | Deban11 | B | Oct. 22, 2023, 8:21 a.m. | OK | Java 21 | TESTS | 11 | 997 | 0 | ||
229201383 | safarisoul | B | Oct. 22, 2023, 10:41 a.m. | OK | Java 8 | TESTS | 11 | 124 | 0 | ||
229195528 | clcwcxfwf | B | Oct. 22, 2023, 9:50 a.m. | OK | Java 8 | TESTS | 11 | 139 | 0 | ||
229174390 | Fredootan | B | Oct. 22, 2023, 8:12 a.m. | OK | Java 8 | TESTS | 11 | 140 | 0 | ||
229179298 | Tomatos03 | B | Oct. 22, 2023, 8:28 a.m. | OK | Java 8 | TESTS | 11 | 155 | 0 | ||
229173653 | ZXF_521mua | B | Oct. 22, 2023, 8:10 a.m. | OK | Java 8 | TESTS | 11 | 155 | 0 | ||
229172923 | mohamedhassan_c | B | Oct. 22, 2023, 8:07 a.m. | OK | Java 8 | TESTS | 11 | 155 | 7372800 | ||
229174785 | Udayf | B | Oct. 22, 2023, 8:13 a.m. | OK | Java 8 | TESTS | 11 | 156 | 0 | ||
229193495 | American_Eagle | B | Oct. 22, 2023, 9:35 a.m. | OK | Java 8 | TESTS | 11 | 171 | 0 | ||
229175029 | puriabhijit000 | B | Oct. 22, 2023, 8:14 a.m. | OK | Java 8 | TESTS | 11 | 171 | 0 | ||
229196455 | FueledByBesh | B | Oct. 22, 2023, 9:57 a.m. | OK | Java 8 | TESTS | 11 | 748 | 0 | ||
229197131 | ZobninVladislav_It-Team | B | Oct. 22, 2023, 10:03 a.m. | OK | JavaScript | TESTS | 11 | 108 | 12697600 | ||
229199390 | wayyeah | B | Oct. 22, 2023, 10:23 a.m. | OK | MS C++ 2017 | TESTS | 11 | 124 | 2969600 | ||
229200510 | Furgoneta | B | Oct. 22, 2023, 10:33 a.m. | OK | MS C++ 2017 | TESTS | 11 | 139 | 307200 | ||
229180804 | forcedcode | B | Oct. 22, 2023, 8:34 a.m. | OK | MS C++ 2017 | TESTS | 11 | 139 | 2969600 | ||
229200128 | Furgoneta | B | Oct. 22, 2023, 10:30 a.m. | OK | MS C++ 2017 | TESTS | 11 | 140 | 307200 | ||
229182523 | amit_shinde | B | Oct. 22, 2023, 8:40 a.m. | OK | MS C++ 2017 | TESTS | 11 | 140 | 6758400 | ||
229178330 | Sniget | B | Oct. 22, 2023, 8:25 a.m. | OK | MS C++ 2017 | TESTS | 11 | 171 | 1126400 | ||
229306578 | Ir0nic_Joker | B | Oct. 22, 2023, 3:09 p.m. | OK | MS C++ 2017 | TESTS | 11 | 202 | 2150400 | ||
229356092 | SlayerS | B | Oct. 23, 2023, 12:32 a.m. | OK | Node.js | TESTS | 11 | 93 | 20070400 | ||
229350500 | SlayerS | B | Oct. 22, 2023, 9:47 p.m. | OK | Node.js | TESTS | 11 | 93 | 20172800 | ||
229372788 | SlayerS | B | Oct. 23, 2023, 5:43 a.m. | OK | Node.js | TESTS | 11 | 109 | 20172800 | ||
229341875 | SlayerS | B | Oct. 22, 2023, 8:38 p.m. | OK | Node.js | TESTS | 11 | 109 | 21094400 | ||
229344613 | SlayerS | B | Oct. 22, 2023, 9:18 p.m. | OK | Node.js | TESTS | 11 | 124 | 18534400 | ||
229344514 | SlayerS | B | Oct. 22, 2023, 9:16 p.m. | OK | Node.js | TESTS | 11 | 139 | 18534400 | ||
229355065 | SlayerS | B | Oct. 23, 2023, midnight | OK | Node.js | TESTS | 11 | 155 | 18432000 | ||
229350390 | SlayerS | B | Oct. 22, 2023, 9:46 p.m. | OK | Node.js | TESTS | 11 | 155 | 18841600 | ||
229290168 | SlayerS | B | Oct. 22, 2023, 1:11 p.m. | OK | Node.js | TESTS | 11 | 170 | 18534400 | ||
229298929 | SlayerS | B | Oct. 22, 2023, 2:16 p.m. | OK | Node.js | TESTS | 11 | 170 | 21094400 | ||
229309795 | iedfa | B | Oct. 22, 2023, 3:34 p.m. | OK | PyPy 3 | TESTS | 11 | 218 | 9216000 | ||
229186983 | test_test_test123 | B | Oct. 22, 2023, 8:57 a.m. | OK | PyPy 3 | TESTS | 11 | 249 | 16076800 | ||
229182511 | quwexzzz | B | Oct. 22, 2023, 8:40 a.m. | OK | PyPy 3 | TESTS | 11 | 280 | 17920000 | ||
229173210 | hugenoob | B | Oct. 22, 2023, 8:08 a.m. | OK | PyPy 3 | TESTS | 11 | 295 | 16281600 | ||
229174197 | bkdn23.ryujin | B | Oct. 22, 2023, 8:11 a.m. | OK | PyPy 3 | TESTS | 11 | 327 | 12800000 | ||
229193812 | engii | B | Oct. 22, 2023, 9:37 a.m. | OK | PyPy 3 | TESTS | 11 | 358 | 14745600 | ||
229186691 | darshana_s | B | Oct. 22, 2023, 8:56 a.m. | OK | PyPy 3 | TESTS | 11 | 404 | 17100800 | ||
229364392 | 123gjweq2 | B | Oct. 23, 2023, 3:33 a.m. | OK | PyPy 3 | TESTS | 11 | 405 | 10956800 | ||
229300550 | mockingbirdd | B | Oct. 22, 2023, 2:26 p.m. | OK | PyPy 3 | TESTS | 11 | 421 | 11673600 | ||
229186695 | ilunzon | B | Oct. 22, 2023, 8:56 a.m. | OK | PyPy 3 | TESTS | 11 | 467 | 10956800 | ||
229307086 | plevande | B | Oct. 22, 2023, 3:13 p.m. | OK | PyPy 3-64 | TESTS | 11 | 108 | 12288000 | ||
229194083 | maoxiang | B | Oct. 22, 2023, 9:39 a.m. | OK | PyPy 3-64 | TESTS | 11 | 109 | 11980800 | ||
229326154 | Super_Misha | B | Oct. 22, 2023, 5:55 p.m. | OK | PyPy 3-64 | TESTS | 11 | 124 | 14233600 | ||
229194904 | kavorka | B | Oct. 22, 2023, 9:45 a.m. | OK | PyPy 3-64 | TESTS | 11 | 124 | 14643200 | ||
229265469 | AJinGoo | B | Oct. 22, 2023, 12:29 p.m. | OK | PyPy 3-64 | TESTS | 11 | 124 | 16179200 | ||
229192628 | Mohamed_Hamed | B | Oct. 22, 2023, 9:29 a.m. | OK | PyPy 3-64 | TESTS | 11 | 124 | 16486400 | ||
229193212 | vedantmishra69 | B | Oct. 22, 2023, 9:33 a.m. | OK | PyPy 3-64 | TESTS | 11 | 124 | 21094400 | ||
229178399 | DeadlyFe | B | Oct. 22, 2023, 8:25 a.m. | OK | PyPy 3-64 | TESTS | 11 | 139 | 13414400 | ||
229195009 | sbdkdlalit0112 | B | Oct. 22, 2023, 9:46 a.m. | OK | PyPy 3-64 | TESTS | 11 | 140 | 23552000 | ||
229185821 | kimrreshi | B | Oct. 22, 2023, 8:53 a.m. | OK | PyPy 3-64 | TESTS | 11 | 155 | 13107200 | ||
229190792 | rvronak | B | Oct. 22, 2023, 9:19 a.m. | OK | Python 3 | TESTS | 11 | 156 | 12185600 | ||
229174509 | AhtheUncertainty | B | Oct. 22, 2023, 8:12 a.m. | OK | Python 3 | TESTS | 11 | 202 | 15052800 | ||
229177714 | blazinglion | B | Oct. 22, 2023, 8:23 a.m. | OK | Python 3 | TESTS | 11 | 233 | 11571200 | ||
229370437 | pennymagic156 | B | Oct. 23, 2023, 5:13 a.m. | OK | Python 3 | TESTS | 11 | 249 | 10342400 | ||
229184069 | Vladko_baro_frajer | B | Oct. 22, 2023, 8:46 a.m. | OK | Python 3 | TESTS | 11 | 264 | 4300800 | ||
229191074 | eugalt | B | Oct. 22, 2023, 9:20 a.m. | OK | Python 3 | TESTS | 11 | 265 | 4505600 | ||
229177417 | camgal04 | B | Oct. 22, 2023, 8:22 a.m. | OK | Python 3 | TESTS | 11 | 280 | 819200 | ||
229191950 | anshit.gupta | B | Oct. 22, 2023, 9:25 a.m. | OK | Python 3 | TESTS | 11 | 280 | 1433600 | ||
229186397 | RuoqiCCC | B | Oct. 22, 2023, 8:55 a.m. | OK | Python 3 | TESTS | 11 | 280 | 2355200 | ||
229181317 | betaboomer | B | Oct. 22, 2023, 8:36 a.m. | OK | Python 3 | TESTS | 11 | 280 | 3891200 | ||
229179485 | rishabh_ag | B | Oct. 22, 2023, 8:29 a.m. | OK | Ruby 3 | TESTS | 11 | 608 | 9830400 | ||
229189329 | Rajveer_100 | B | Oct. 22, 2023, 9:04 a.m. | OK | Rust 2021 | TESTS | 11 | 31 | 2048000 | ||
229340140 | namanlp | B | Oct. 22, 2023, 8:15 p.m. | OK | Rust 2021 | TESTS | 11 | 92 | 1024000 | ||
229175804 | coding_lyf2 | B | Oct. 22, 2023, 8:17 a.m. | OK | Rust 2021 | TESTS | 11 | 93 | 2355200 | ||
229181664 | Loganwick | B | Oct. 22, 2023, 8:37 a.m. | OK | Rust 2021 | TESTS | 11 | 109 | 2662400 |
Back to search problems