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. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 6835 ) | D | Fixing a Binary String | PROGRAMMING | bitmasks brute force constructive algorithms greedy hashing strings |
B'You are given a binary string s of length n , consisting of zeros and ones. You can perform the following operation exactly once: For example, if you apply the operation to the string 110001100110 with p=3 , after the second step, the string will become 011001100110, and after the third step, it will become 001100110011. A string s is called k -proper if two conditions are met: For example, with k=3 , the strings 000, 111000111, and 111000 are k -proper, while the strings 000000, 001100, and 1110000 are not. You are given an integer k , which is a divisor of n . Find an integer p ( 1 <= p <= n ) such that after performing the operation, the string s becomes k -proper, or determine that it is impossible. Note that if the string is initially k -proper, you still need to apply exactly one operation to it. Each test consists of multiple test cases. The first line contains one 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 two integers n and k ( 1 <= k <= n , 2 <= n <= 10^5 ) -- the length of the string s and the value of k . It is guaranteed that k is a divisor of n . The second line of each test case contains a binary string s of length n , consisting of the characters 0 and 1. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the value of p to make the string k -proper, or -1 if it is impossible. If there are multiple solutions, output any of them. In the first test case, if you apply the operation with p=3 , after the second step of the operation, the string becomes 11100001, and after the third step, it becomes 00001111. This string is 4 -proper. In the second test case, it can be shown that the'... |
Codeforces Round 951 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
264487974 | doublethinker | D | June 6, 2024, 4:32 p.m. | OK | C# 10 | TESTS | 15 | 140 | 3072000 | ||
264488200 | x1f0cb32d3_ | D | June 6, 2024, 4:32 p.m. | OK | C# 10 | TESTS | 15 | 1639 | 6963200 | ||
264543787 | TRYING_To_Do_Better__ | D | June 7, 2024, 5:26 a.m. | OK | C++14 (GCC 6-32) | TESTS | 21 | 46 | 0 | ||
264538233 | spacedate_xacs | D | June 7, 2024, 4:30 a.m. | OK | C++14 (GCC 6-32) | TESTS | 19 | 46 | 0 | ||
264523984 | aryamsingh7676 | D | June 7, 2024, 12:47 a.m. | OK | C++14 (GCC 6-32) | TESTS | 16 | 46 | 0 | ||
264511304 | 031_harsh | D | June 6, 2024, 8:04 p.m. | OK | C++14 (GCC 6-32) | TESTS | 16 | 46 | 0 | ||
264502673 | vjudge2 | D | June 6, 2024, 6:26 p.m. | OK | C++14 (GCC 6-32) | TESTS | 16 | 46 | 0 | ||
264526635 | OctoberEstuary | D | June 7, 2024, 1:46 a.m. | OK | C++14 (GCC 6-32) | TESTS | 16 | 46 | 409600 | ||
264543185 | Prasanna_Jangali | D | June 7, 2024, 5:21 a.m. | OK | C++14 (GCC 6-32) | TESTS | 21 | 46 | 2662400 | ||
264542501 | LG805653 | D | June 7, 2024, 5:14 a.m. | OK | C++14 (GCC 6-32) | TESTS | 21 | 46 | 4505600 | ||
264539821 | ddl_yyds | D | June 7, 2024, 4:47 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 46 | 8089600 | ||
264526161 | tahoangquan2 | D | June 7, 2024, 1:36 a.m. | OK | C++14 (GCC 6-32) | TESTS | 16 | 61 | 0 | ||
264547621 | msdeokar07 | D | June 7, 2024, 6:01 a.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
264541429 | Gotsuhan | D | June 7, 2024, 5:03 a.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
264541137 | ashu_bhatta | D | June 7, 2024, 5 a.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
264540722 | Tushal_Mendpara | D | June 7, 2024, 4:56 a.m. | OK | C++17 (GCC 7-32) | TESTS | 21 | 46 | 0 | ||
264537748 | atul.raj | D | June 7, 2024, 4:24 a.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 46 | 0 | ||
264537693 | kelzzin2_fan | D | June 7, 2024, 4:24 a.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 46 | 0 | ||
264535544 | sagar54 | D | June 7, 2024, 3:59 a.m. | OK | C++17 (GCC 7-32) | TESTS | 17 | 46 | 0 | ||
264535037 | lucky__389 | D | June 7, 2024, 3:52 a.m. | OK | C++17 (GCC 7-32) | TESTS | 17 | 46 | 0 | ||
264534680 | xiang-ji | D | June 7, 2024, 3:48 a.m. | OK | C++17 (GCC 7-32) | TESTS | 16 | 46 | 0 | ||
264534099 | noneothis | D | June 7, 2024, 3:40 a.m. | OK | C++17 (GCC 7-32) | TESTS | 16 | 46 | 0 | ||
264544060 | Fiatiustitia | D | June 7, 2024, 5:29 a.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 46 | 0 | ||
264543359 | zzh.free | D | June 7, 2024, 5:22 a.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 46 | 0 | ||
264541827 | Muhammad_Aneeq | D | June 7, 2024, 5:08 a.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 46 | 0 | ||
264541453 | ghost_9 | D | June 7, 2024, 5:04 a.m. | OK | C++20 (GCC 13-64) | TESTS | 21 | 46 | 0 | ||
264538269 | paneerpyaz | D | June 7, 2024, 4:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 46 | 0 | ||
264537822 | SLZSM | D | June 7, 2024, 4:25 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 46 | 0 | ||
264537537 | SLZSM | D | June 7, 2024, 4:22 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 46 | 0 | ||
264537185 | afvikas | D | June 7, 2024, 4:19 a.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 46 | 0 | ||
264537067 | vaibhavi812 | D | June 7, 2024, 4:18 a.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 46 | 0 | ||
264536607 | Youssef_2 | D | June 7, 2024, 4:13 a.m. | OK | C++20 (GCC 13-64) | TESTS | 17 | 46 | 0 | ||
264526883 | 79209748 | D | June 7, 2024, 1:51 a.m. | OK | Go | TESTS | 16 | 46 | 5632000 | ||
264532554 | nguyenquocthao00 | D | June 7, 2024, 3:18 a.m. | OK | Go | TESTS | 16 | 62 | 3993600 | ||
264485991 | himanshu-0104 | D | June 6, 2024, 4:28 p.m. | OK | Go | TESTS | 15 | 77 | 7782400 | ||
264525936 | 79209748 | D | June 7, 2024, 1:31 a.m. | OK | Go | TESTS | 16 | 718 | 7577600 | ||
264526120 | 79209748 | D | June 7, 2024, 1:35 a.m. | OK | Go | TESTS | 16 | 890 | 7270400 | ||
264535682 | xobe19 | D | June 7, 2024, 4:01 a.m. | OK | Java 21 | TESTS | 17 | 249 | 204800 | ||
264485466 | new2ac | D | June 6, 2024, 4:27 p.m. | OK | Java 21 | TESTS | 15 | 264 | 614400 | ||
264515625 | aishwarykesarwani | D | June 6, 2024, 9:07 p.m. | OK | Java 21 | TESTS | 16 | 265 | 716800 | ||
264507999 | Eslam_Ahmed | D | June 6, 2024, 7:22 p.m. | OK | Java 21 | TESTS | 16 | 265 | 1843200 | ||
264514920 | dzhi | D | June 6, 2024, 8:56 p.m. | OK | Java 21 | TESTS | 16 | 280 | 614400 | ||
264517945 | SD125 | D | June 6, 2024, 9:51 p.m. | OK | Java 21 | TESTS | 16 | 280 | 716800 | ||
264547196 | priyaroy3370 | D | June 7, 2024, 5:58 a.m. | OK | Java 21 | TESTS | 21 | 280 | 1228800 | ||
264517462 | pulkitdarky | D | June 6, 2024, 9:41 p.m. | OK | Java 21 | TESTS | 16 | 281 | 1024000 | ||
264515018 | dzhi | D | June 6, 2024, 8:57 p.m. | OK | Java 21 | TESTS | 16 | 296 | 614400 | ||
264535778 | testtest111ksjfrdvn | D | June 7, 2024, 4:02 a.m. | OK | Java 21 | TESTS | 17 | 296 | 819200 | ||
264517874 | vatsal_04 | D | June 6, 2024, 9:50 p.m. | OK | Java 8 | TESTS | 16 | 140 | 0 | ||
264507485 | Shaykhutdinov-T-I | D | June 6, 2024, 7:16 p.m. | OK | Java 8 | TESTS | 16 | 140 | 0 | ||
264538713 | achyut88 | D | June 7, 2024, 4:35 a.m. | OK | Java 8 | TESTS | 19 | 171 | 0 | ||
264494184 | Yousef_Badr | D | June 6, 2024, 5:26 p.m. | OK | Java 8 | TESTS | 15 | 171 | 0 | ||
264493385 | invincible777 | D | June 6, 2024, 5:22 p.m. | OK | Java 8 | TESTS | 15 | 171 | 0 | ||
264522984 | RahulAhuja2901 | D | June 7, 2024, 12:20 a.m. | OK | Java 8 | TESTS | 16 | 186 | 0 | ||
264495343 | tirthgohil1410 | D | June 6, 2024, 5:32 p.m. | OK | Java 8 | TESTS | 16 | 186 | 0 | ||
264523051 | RahulAhuja2901 | D | June 7, 2024, 12:22 a.m. | OK | Java 8 | TESTS | 16 | 187 | 0 | ||
264510906 | PlayDate | D | June 6, 2024, 7:59 p.m. | OK | Java 8 | TESTS | 16 | 249 | 0 | ||
264488537 | om172 | D | June 6, 2024, 4:33 p.m. | OK | Java 8 | TESTS | 15 | 280 | 0 | ||
264488508 | gsgreat9002 | D | June 6, 2024, 4:33 p.m. | OK | Kotlin 1.7 | TESTS | 15 | 1125 | 152576000 | ||
264485775 | sahild2003 | D | June 6, 2024, 4:28 p.m. | OK | Kotlin 1.7 | TESTS | 15 | 1296 | 151040000 | ||
264492703 | wangchaohui | D | June 6, 2024, 5:20 p.m. | OK | Kotlin 1.9 | TESTS | 15 | 249 | 0 | ||
264494625 | CepGamer | D | June 6, 2024, 5:28 p.m. | OK | Kotlin 1.9 | TESTS | 15 | 296 | 102400 | ||
264544359 | Heartbeateffect | D | June 7, 2024, 5:32 a.m. | OK | PyPy 3 | TESTS | 21 | 296 | 12288000 | ||
264513056 | dnzc | D | June 6, 2024, 8:30 p.m. | OK | PyPy 3 | TESTS | 16 | 358 | 9113600 | ||
264487430 | mathpig | D | June 6, 2024, 4:31 p.m. | OK | PyPy 3 | TESTS | 15 | 1374 | 13107200 | ||
264529080 | mikeac | D | June 7, 2024, 2:28 a.m. | OK | PyPy 3-64 | TESTS | 16 | 139 | 5529600 | ||
264502179 | Slata | D | June 6, 2024, 6:22 p.m. | OK | PyPy 3-64 | TESTS | 16 | 139 | 12800000 | ||
264515339 | strashila | D | June 6, 2024, 9:02 p.m. | OK | PyPy 3-64 | TESTS | 16 | 140 | 6144000 | ||
264494568 | zhengyi20thu | D | June 6, 2024, 5:28 p.m. | OK | PyPy 3-64 | TESTS | 15 | 155 | 6246400 | ||
264511355 | vedantmishra69 | D | June 6, 2024, 8:05 p.m. | OK | PyPy 3-64 | TESTS | 16 | 155 | 16076800 | ||
264528095 | JinYuManTang | D | June 7, 2024, 2:12 a.m. | OK | PyPy 3-64 | TESTS | 16 | 156 | 7065600 | ||
264499440 | _twi_nami | D | June 6, 2024, 6 p.m. | OK | PyPy 3-64 | TESTS | 16 | 156 | 8704000 | ||
264499235 | _Ciel | D | June 6, 2024, 5:58 p.m. | OK | PyPy 3-64 | TESTS | 16 | 156 | 8704000 | ||
264547268 | Prasham | D | June 7, 2024, 5:58 a.m. | OK | PyPy 3-64 | TESTS | 21 | 171 | 26214400 | ||
264492354 | mgoldy925 | D | June 6, 2024, 5:18 p.m. | OK | PyPy 3-64 | TESTS | 15 | 186 | 10444800 | ||
264537951 | Mr_Surfer | D | June 7, 2024, 4:26 a.m. | OK | Python 3 | TESTS | 19 | 186 | 1228800 | ||
264489194 | harshs_21 | D | June 6, 2024, 4:34 p.m. | OK | Python 3 | TESTS | 15 | 515 | 8294400 | ||
264489096 | vkminh08hanam | D | June 6, 2024, 4:33 p.m. | OK | Python 3 | TESTS | 15 | 561 | 4915200 | ||
264489645 | rohitsadhu | D | June 6, 2024, 4:34 p.m. | OK | Python 3 | TESTS | 15 | 561 | 8294400 | ||
264489442 | 007Abdulrahman | D | June 6, 2024, 4:34 p.m. | OK | Python 3 | TESTS | 15 | 561 | 8294400 | ||
264498065 | Ashish_Jha_ | D | June 6, 2024, 5:49 p.m. | OK | Python 3 | TESTS | 16 | 562 | 8294400 | ||
264488521 | IbrahimTN | D | June 6, 2024, 4:33 p.m. | OK | Python 3 | TESTS | 15 | 562 | 8294400 | ||
264489871 | itzme_dhruv | D | June 6, 2024, 4:34 p.m. | OK | Python 3 | TESTS | 15 | 577 | 8294400 | ||
264512722 | nobiyo6687 | D | June 6, 2024, 8:25 p.m. | OK | Python 3 | TESTS | 16 | 577 | 8499200 | ||
264490089 | firstdeath69690 | D | June 6, 2024, 4:34 p.m. | OK | Python 3 | TESTS | 15 | 577 | 8499200 | ||
264489002 | parth_7042 | D | June 6, 2024, 4:33 p.m. | OK | Ruby 3 | TESTS | 15 | 906 | 10547200 | ||
264502824 | rli43 | D | June 6, 2024, 6:27 p.m. | OK | Rust 2021 | TESTS | 16 | 46 | 0 | ||
264501434 | toor | D | June 6, 2024, 6:16 p.m. | OK | Rust 2021 | TESTS | 16 | 46 | 0 | ||
264501220 | ArnedeB | D | June 6, 2024, 6:14 p.m. | OK | Rust 2021 | TESTS | 16 | 62 | 0 | ||
264538072 | vstiff | D | June 7, 2024, 4:28 a.m. | OK | Rust 2021 | TESTS | 19 | 77 | 0 | ||
264488105 | DreadedHippy | D | June 6, 2024, 4:32 p.m. | OK | Rust 2021 | TESTS | 15 | 77 | 0 | ||
264523140 | BetterThanNobita | D | June 7, 2024, 12:24 a.m. | OK | Rust 2021 | TESTS | 16 | 77 | 6451200 | ||
264487239 | CoCo_Japan_pan | D | June 6, 2024, 4:30 p.m. | OK | Rust 2021 | TESTS | 15 | 92 | 102400 | ||
264505623 | M1ngXu | D | June 6, 2024, 6:56 p.m. | OK | Rust 2021 | TESTS | 16 | 156 | 9113600 |
Back to search problems