#P8589. 『JROI-8』对了,还有花,少女,银河

    ID: 9439 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>洛谷原创Special Judge构造洛谷月赛

『JROI-8』对了,还有花,少女,银河

Background

1663764189387.png

"Part 1"
Even if I turn into bones, there are still things I do not want to forget.

Reprint permission has been granted.

Problem Description

Given nn, construct a binary string of length nn containing only 0,10,1 such that the numbers of occurrences of 01,00,10,1101,00,10,11 are equal, or report that there is no solution.

Here, an "occurrence" means being exactly the same as a consecutive substring of the original string. For example, in 10111011011101, the numbers of occurrences of 01,00,10,1101,00,10,11 are 2,0,2,22,0,2,2, respectively.

Note that the large sample is not provided as an attached file, but is placed directly in Sample #3 of the Input/Output Samples.

Input Format

One line containing a positive integer nn.

Output Format

If there is a solution, output one line with a length nn binary string containing only 0,10,1 that satisfies the condition.

If there is no solution, output -1.

3
-1
5
00110
15400
-1

Hint

Constraints

Test Point ID Score nn\leq Special Property
121\sim 2 2020 55 None
343\sim 4 10610^6 nmod4=0n \bmod 4 = 0
565\sim 6 2020 None
7107 \sim 10 4040 10610^6

Translated by ChatGPT 5