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 |
|---|---|---|---|---|---|---|
| 2092 | Codeforces Round 1014 (Div. 2) | FINISHED | False | 7200 | 33146722 | March 29, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 428 ) | F | Andryusha and CCB | PROGRAMMING | brute force constructive algorithms greedy math number theory strings |
Let us define the beauty of a binary string (z) as the number of indices (i) such that (1 \le i < |z|) and (z_i \neq z_{i+1}). While waiting for his friends from the CCB, Andryusha baked a pie, represented by a binary string (s) of length (n). To avoid offending anyone, he wants to divide this string into (k) substrings such that each digit belongs to exactly one substring, and the beauties of all substrings are the same. Andryusha does not know the exact number of friends from the CCB who will come to his house, so he wants to find the number of values of (k) for which it is possible to split the pie into exactly (k) parts with equal beauties. However, Andryusha's brother, Tristan, decided that this formulation of the problem is too simple. Therefore, he wants you to find the number of such values of (k) for each prefix of the string . In other words, for each (i) from (1) to (n), you need to find the number of values of (k) for which it is possible to split the prefix (s_1 s_2 \ldots s_i) into exactly (k) parts with equal beauties. Each test consists of several test cases. The first line of the input data contains one 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 \leq n \leq 10^6)) — the length of the binary string. The second line of each test case contains a binary string of length (n), consisting only of digits 0 and 1 . It is guaranteed that the sum of (n) across all test cases does not exceed (10^6). For each test case, output a single line containing (n) integers (c_i) ((0 \le c_i \le n)) — the number of values of (k) for which it is possible to split the prefix (s_1 s_2 \ldots s_i) into exactly (k) parts with equal beauties. In the third case, the values of (k) that satisfy the conditions are: (i = 1): |
| Codeforces Round #1014 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 313039783 | bookcat | F | March 29, 2025, 6:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 249 | 6041600 | ||
| 313046426 | Sudipto_Pal | F | March 29, 2025, 7:46 p.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 358 | 17408000 | ||
| 313058505 | Cody473 | F | March 29, 2025, 11:25 p.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 374 | 17408000 | ||
| 313068075 | Mabingnan__V | F | March 30, 2025, 3:13 a.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 374 | 17612800 | ||
| 313070961 | Himeno_Towa | F | March 30, 2025, 4:05 a.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 515 | 9113600 | ||
| 313053701 | kaka_haha | F | March 29, 2025, 9:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 546 | 9113600 | ||
| 313063436 | Sparkle_Twilight | F | March 30, 2025, 1:43 a.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 561 | 11673600 | ||
| 313063319 | potato167 | F | March 30, 2025, 1:40 a.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 561 | 11673600 | ||
| 313049674 | abeker | F | March 29, 2025, 8:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 1186 | 11468800 | ||
| 313037648 | SmolBrain | F | March 29, 2025, 6:12 p.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 1625 | 43520000 | ||
| 313040101 | bookcat | F | March 29, 2025, 6:35 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 171 | 5017600 | ||
| 313040426 | bookcat | F | March 29, 2025, 6:39 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 202 | 6041600 | ||
| 313039951 | bookcat | F | March 29, 2025, 6:34 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 233 | 6041600 | ||
| 313064267 | IshigamiSenku | F | March 30, 2025, 2 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 249 | 18636800 | ||
| 313079273 | enslaved | F | March 30, 2025, 5:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 280 | 14438400 | ||
| 313024023 | A_G | F | March 29, 2025, 4:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 749 | 11673600 | ||
| 313031443 | HS90R | F | March 29, 2025, 5:27 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 764 | 14438400 | ||
| 313048606 | turkhuu622 | F | March 29, 2025, 8:13 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 796 | 209305600 | ||
| 313064882 | BLuemoon_ | F | March 30, 2025, 2:12 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 827 | 32153600 | ||
| 313034415 | BucketPotato | F | March 29, 2025, 5:45 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 1000 | 35532800 | ||
| 313054929 | SinhaSatwik | F | March 29, 2025, 9:53 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 202 | 18739200 | ||
| 313055444 | Boboge | F | March 29, 2025, 10:04 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 296 | 14745600 | ||
| 313033102 | fastmath | F | March 29, 2025, 5:36 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 405 | 14848000 | ||
| 313035365 | zsmihaly | F | March 29, 2025, 5:52 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 515 | 14540800 | ||
| 313032403 | Arozustan | F | March 29, 2025, 5:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 561 | 19660800 | ||
| 313034218 | JakeMate14 | F | March 29, 2025, 5:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 624 | 12800000 | ||
| 313039322 | ymmparsa | F | March 29, 2025, 6:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 624 | 19763200 | ||
| 313070471 | chenlinxuan0226 | F | March 30, 2025, 3:56 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 733 | 19763200 | ||
| 313069817 | guanyf | F | March 30, 2025, 3:44 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 843 | 40140800 | ||
| 313054675 | catgirl | F | March 29, 2025, 9:48 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 859 | 47001600 | ||
| 313032315 | DanielAnker | F | March 29, 2025, 5:31 p.m. | OK | Rust 2021 | TESTS | 44 | 1155 | 51507200 |
Back to search problems