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 |
|---|---|---|---|---|---|---|
| 2183 | Hello 2026 | FINISHED | False | 10800 | 8609123 | Jan. 7, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 79 ) | I1 | Pairs Flipping (Easy Version) | PROGRAMMING | constructive algorithms |
This is the easy version of the problem. The difference between the versions is that in this version, the restriction on the number of 1 's remaining in the final string is more lenient. You can hack only if you solved all versions of this problem. You are given a binary string (s_1s_2\ldots s_n) containing only characters 0 and 1 . You may perform (\lfloor\frac{n}{2}\rfloor) operations. On the (x)-th operation, you may perform the following: Select an integer (l) such that (0 \leq l \leq n-x). If (l=0), then nothing is done. Otherwise, the characters (s_l) and (s_{l+x}) are both flipped. That is, for each character, if it is (0), then it is changed to (1), and vice versa. Your task is to find a series of operations such that the number of 1 's remaining in the binary string is at most (15). It can be shown that under the constraints of this problem, this is always possible. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^5)). The description of the test cases follows. The first line of each test case contains an integer (n) ((3 \leq n \leq 2\cdot 10^6)). The second line of each test case contains a binary string (s_1s_2\ldots s_n) ((s_i \in \{0,1\})). It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot 10^6). For each test case, output (\lfloor\frac{n}{2}\rfloor) numbers on a new line: the chosen (l) for operation (1,2,\ldots,\lfloor\frac{n}{2}\rfloor (0 \leq l_x \leq n-x)). You should guarantee that after all operations, there are at most (15) 1 remaining in the string. If there are multiple solutions, output any. In the fourth test case: Initially, (s=) 111111111 . Since (n=9), we perform (\lfloor\frac{9}{2}\rfloor=4) operations. The first operation has (l=6). Therefore, characters (6) and (6+1=7) are flipped. Now, (s=) 111110011 . The second ope |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 356901089 | qwef_ | I1 | Jan. 8, 2026, 4:36 a.m. | OK | C++17 (GCC 7-32) | TESTS | 140 | 234 | 20480000 | ||
| 356890574 | Legend_of_Bangladesh | I1 | Jan. 8, 2026, 1:30 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 140 | 125 | 9728000 | ||
| 356887726 | scorpion | I1 | Jan. 7, 2026, 11:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 140 | 125 | 9728000 | ||
| 356890830 | scau_accepted | I1 | Jan. 8, 2026, 1:37 a.m. | OK | Go | TESTS | 140 | 140 | 43110400 | ||
| 356886986 | Darknef | I1 | Jan. 7, 2026, 11:16 p.m. | OK | Rust 2024 | TESTS | 140 | 203 | 73420800 |
Back to search problems