1352F.md (1916B)
1 Source: https://codeforces.com/problemset/problem/1352/F 2 3 F. Binary String Reconstruction 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 For some binary string $s$ (i.e. each character $s_i$ is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length $2$ were written. For each pair (substring of length $2$), the number of '1' (ones) in it was calculated. 22 23 You are given three numbers: 24 25 * $n_0$ — the number of such pairs of consecutive characters (substrings) where the number of ones equals $0$; 26 * $n_1$ — the number of such pairs of consecutive characters (substrings) where the number of ones equals $1$; 27 * $n_2$ — the number of such pairs of consecutive characters (substrings) where the number of ones equals $2$. 28 29 For example, for the string $s=$"1110011110", the following substrings would be written: "11", "11", "10", "00", "01", "11", "11", "11", "10". Thus, $n_0=1$, $n_1=3$, $n_2=5$. 30 31 Your task is to restore any suitable binary string $s$ from the given values $n_0, n_1, n_2$. It is guaranteed that at least one of the numbers $n_0, n_1, n_2$ is greater than $0$. Also, it is guaranteed that a solution exists. 32 33 Input 34 35 The first line contains an integer $t$ ($1 \le t \le 1000$) — the number of test cases in the input. Then test cases follow. 36 37 Each test case consists of one line which contains three integers $n_0, n_1, n_2$ ($0 \le n_0, n_1, n_2 \le 100$; $n_0 + n_1 + n_2 \gt 0$). It is guaranteed that the answer for given $n_0, n_1, n_2$ exists. 38 39 Output 40 41 Print $t$ lines. Each of the lines should contain a binary string corresponding to a test case. If there are several possible solutions, print any of them. 42 43 Example 44 45 Input 46 47 ``` 48 7 49 1 3 5 50 1 1 1 51 3 9 3 52 0 1 0 53 3 1 2 54 0 0 3 55 2 0 0 56 ``` 57 58 Output 59 60 ``` 61 1110011110 62 0011 63 0110001100101011 64 10 65 0000111 66 1111 67 000 68 ```