Problem - C - Codeforces
Problem - C - Codeforces
Enter | Register
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP ICPC CHALLENGE
PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS HACKS ROOM STANDINGS CUSTOM INVOCATION
The first line of each test case contains a single integer n (1 ≤ n ≤ 100 ) — the length of constructive algorithms implementation
string s , respectively. No tag edit access
The second line of each test case contains a string s with length n.
→ Contest materials
It is guaranteed that s only consists of 0 and 1.
Announcement (en)
Output
For each test case, if it impossible to make s good, output −1. Tutorial (en)
Then, output p integers in the second line. The i -th integer should be an index x i (
0 ≤ x i ≤ n + 2i − 2) — the position where you want to insert 01 in the current s . If
x i = 0 , you insert 01 at the beginning of s . Otherwise, you insert 01 immediately after the x i
-th character of s .
We can show that under the constraints in this problem, if an answer exists, there is always an
answer that requires at most 300 operations.
Example
input Copy
6
2
01
3
000
4
1111
6
001110
10
0111001100
3
001
output Copy
https://codeforces.com/contest/1890/problem/C 1/2
31/10/2023, 10:38 Problem - C - Codeforces
0
-1
-1
2
6 7
1
10
-1
Note
In the first test case, you can do zero operations and get s = 01 , which is good.
1. 0011
–––
In the second and the third test case, it is impossible to make s good.
1. 00111001
–––
2. 0011100011
–––
Supported by
https://codeforces.com/contest/1890/problem/C 2/2