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 |
|---|---|---|---|---|---|---|
| 2189 | Codeforces Round 1075 (Div. 2) | FINISHED | False | 7200 | 7226723 | Jan. 23, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 808 ) | E | Majority Wins? | PROGRAMMING | dp greedy math strings |
You are given a binary string(^{\text{∗}}) (s) of length (n). In one operation with a binary string (g) of length (k), you can do the following: choose some (l, r) such that (1 \leq l \leq r \leq k); replace the substring(^{\text{†}}) (g_l, \ldots, g_r) of the string (g) with one character that appears in this substring at least as many times as the other character. The cost of such an operation will be equal to (r-l+1). For example, the string 010010 can be transformed into 010 in one operation with a cost of (4) by replacing the substring 1001 with 1 ; the string 1111 can be transformed into 1 by performing an operation with a cost of (4) on the entire string, and the string 0100 can be transformed, for example, into 00 by taking the substring 100 . You need to find the minimum cost to transform the entire string (s) into the string 1 , using several (possibly none) operations, or determine that it is impossible. (^{\text{∗}})A binary string is a string that only consists of characters (0) and (1). (^{\text{†}})A string (t) is a substring of a string (g) if (t) can be obtained from (g) by the deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \leq n \leq 5 \cdot 10^5)) — the length of the binary string. The second line of each test case contains a string of length (n), consisting of the characters 0 and 1 — the string (s). It is guaranteed that the sum of (n) over all test cases does not exceed (5 \cdot 10^5). For each test case, if it is impossible to obtain the string 1 , output (-1). Otherwise, output the minimum cost. In the |
| Codeforces Round 1075 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 359485752 | tintrungno1 | E | Jan. 24, 2026, 1:50 a.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 102400 | ||
| 359471989 | mateuszmj | E | Jan. 23, 2026, 8:14 p.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 102400 | ||
| 359464079 | CrossFire1 | E | Jan. 23, 2026, 6:49 p.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 102400 | ||
| 359449279 | Allorkiya | E | Jan. 23, 2026, 5:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 102400 | ||
| 359485159 | 1121Jiang | E | Jan. 24, 2026, 1:34 a.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 614400 | ||
| 359450368 | god-knows-who | E | Jan. 23, 2026, 5:11 p.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 614400 | ||
| 359484573 | 1121Jiang | E | Jan. 24, 2026, 1:18 a.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 1126400 | ||
| 359457416 | vito1036 | E | Jan. 23, 2026, 5:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 2048000 | ||
| 359481792 | cdlake | E | Jan. 23, 2026, 11:47 p.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 4096000 | ||
| 359441914 | ooo0OQ | E | Jan. 23, 2026, 4:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 43 | 46 | 8601600 | ||
| 359501154 | cutemana1214 | E | Jan. 24, 2026, 5:38 a.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359501000 | gnwfgg | E | Jan. 24, 2026, 5:37 a.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359488852 | wwwytz | E | Jan. 24, 2026, 2:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359486030 | cyx | E | Jan. 24, 2026, 1:58 a.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359473125 | bajajshivam178 | E | Jan. 23, 2026, 8:29 p.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359469299 | Vish2503 | E | Jan. 23, 2026, 7:42 p.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359464609 | Alasco | E | Jan. 23, 2026, 6:53 p.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359458058 | pnlong2706 | E | Jan. 23, 2026, 6:02 p.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359456505 | wildhonestfur | E | Jan. 23, 2026, 5:50 p.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359449603 | Sam_2027 | E | Jan. 23, 2026, 5:07 p.m. | OK | C++20 (GCC 13-64) | TESTS | 43 | 46 | 102400 | ||
| 359485539 | daxkofficial | E | Jan. 24, 2026, 1:44 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 0 | ||
| 359484781 | Beware_of_Impotence | E | Jan. 24, 2026, 1:24 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 0 | ||
| 359483891 | icebear_meow | E | Jan. 24, 2026, 12:57 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 0 | ||
| 359487557 | yueyuanzhiyyz | E | Jan. 24, 2026, 2:34 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 102400 | ||
| 359487168 | yangster67 | E | Jan. 24, 2026, 2:26 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 102400 | ||
| 359473064 | Sul_A. | E | Jan. 23, 2026, 8:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 102400 | ||
| 359472811 | pharaok | E | Jan. 23, 2026, 8:25 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 102400 | ||
| 359471622 | dinohaur | E | Jan. 23, 2026, 8:09 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 102400 | ||
| 359469457 | realcomplex | E | Jan. 23, 2026, 7:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 102400 | ||
| 359460717 | jenis854cpy | E | Jan. 23, 2026, 6:21 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 43 | 46 | 102400 | ||
| 359455563 | _criminal | E | Jan. 23, 2026, 5:43 p.m. | OK | GNU C11 | TESTS | 43 | 78 | 1433600 | ||
| 359452311 | _OneMoreTest | E | Jan. 23, 2026, 5:22 p.m. | OK | Go | TESTS | 43 | 62 | 3276800 | ||
| 359488760 | Yousef_Badr | E | Jan. 24, 2026, 2:56 a.m. | OK | Java 21 | TESTS | 43 | 218 | 1433600 | ||
| 359453558 | Power_Rangers_ | E | Jan. 23, 2026, 5:30 p.m. | OK | Java 21 | TESTS | 43 | 250 | 921600 | ||
| 359488565 | Yousef_Badr | E | Jan. 24, 2026, 2:53 a.m. | OK | Java 21 | TESTS | 43 | 250 | 1126400 | ||
| 359456757 | Power_Rangers_ | E | Jan. 23, 2026, 5:52 p.m. | OK | Java 21 | TESTS | 43 | 265 | 819200 | ||
| 359461528 | Power_Rangers_ | E | Jan. 23, 2026, 6:26 p.m. | OK | Java 21 | TESTS | 43 | 265 | 1740800 | ||
| 359487596 | aha | E | Jan. 24, 2026, 2:34 a.m. | OK | Java 21 | TESTS | 43 | 265 | 2048000 | ||
| 359461810 | Yousef_Badr | E | Jan. 23, 2026, 6:29 p.m. | OK | Java 21 | TESTS | 43 | 281 | 1740800 | ||
| 359463478 | Ergodic137 | E | Jan. 23, 2026, 6:43 p.m. | OK | PyPy 3-64 | TESTS | 43 | 125 | 6348800 | ||
| 359473636 | eugenechka.boyko.2_0-0 | E | Jan. 23, 2026, 8:36 p.m. | OK | PyPy 3-64 | TESTS | 43 | 187 | 6656000 | ||
| 359483700 | Little_Sheep_Yawn | E | Jan. 24, 2026, 12:52 a.m. | OK | PyPy 3-64 | TESTS | 43 | 187 | 10547200 | ||
| 359473287 | DeadMan69 | E | Jan. 23, 2026, 8:31 p.m. | OK | PyPy 3-64 | TESTS | 43 | 203 | 8806400 | ||
| 359490243 | kaushik.atla | E | Jan. 24, 2026, 3:24 a.m. | OK | PyPy 3-64 | TESTS | 43 | 203 | 8908800 | ||
| 359482827 | isa773 | E | Jan. 24, 2026, 12:23 a.m. | OK | PyPy 3-64 | TESTS | 43 | 203 | 14336000 | ||
| 359457129 | nk_koat29 | E | Jan. 23, 2026, 5:55 p.m. | OK | PyPy 3-64 | TESTS | 43 | 234 | 9011200 | ||
| 359470755 | golomb | E | Jan. 23, 2026, 7:59 p.m. | OK | PyPy 3-64 | TESTS | 43 | 250 | 13619200 | ||
| 359465343 | harurun4635 | E | Jan. 23, 2026, 7 p.m. | OK | PyPy 3-64 | TESTS | 43 | 265 | 14643200 | ||
| 359454485 | tyuyu_62 | E | Jan. 23, 2026, 5:36 p.m. | OK | PyPy 3-64 | TESTS | 43 | 437 | 51814400 |
Back to search problems