P29881 [洛谷] 『JROI-8』对了,还有花,少女,银河
普及
题目描述

Problem Background

1663764189387.png

「其一」\
即使化身白骨,也有不想忘记的东西

已获得转载授权。

Problem Description

Given an integer \( n \), construct a string of length \( n \) consisting only of the digits \( 0 \) and \( 1 \), such that the substrings \( 01 \), \( 00 \), \( 10 \), and \( 11 \) appear an equal number of times. If it is not possible, report that there is no solution.

Here, "appearance" refers to a contiguous part of the string being identical to one of these substrings. For example, in the string \( 1011101 \), \( 01 \), \( 00 \), \( 10 \), and \( 11 \) appear \( 2 \), \( 0 \), \( 2 \), and \( 2 \) times respectively.

Note that the large sample is not provided as a file attachment but is directly included in the Sample Input and Output section as Sample #3.

Input Format

A single line containing a positive integer \( n \).

Output Format

If a solution exists, output a single line containing a string of length \( n \) that meets the conditions and consists only of the digits \( 0 \) and \( 1 \).

If no solution exists, output -1.

Sample Input and Output

Sample Input #1

3

Sample Output #1

-1

Sample Input #2

5

Sample Output #2

00110

Sample Input #3

15400

Sample Output #3

-1

Notes

Data Range and Hints

Test Case Number Points \( n \leq \) Special Properties
\( 1 \sim 2 \) \( 20 \) \( 5 \) None
\( 3 \sim 4 \) \( 20 \) \( 10^6 \) \( n \mod 4 = 0 \)
\( 5 \sim 6 \) \( 20 \) \( 20 \) None
\( 7 \sim 10 \) \( 40 \) \( 10^6 \) None
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3
样例输出
-1