問題一覧 > 通常問題

No.2608 Divide into two

レベル : / AI推定難易度 : 550 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 162
作問者 : 蜜蜂 / テスター : Mitarushi
お気に入りにしたユーザー ProblemId : 8449 / 自分の提出
問題文最終更新日: 2024-01-09 15:53:03
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 415 (順位表) の他の問題:

Problem Statement

Divide the numbers from $1$ to $N$ into $2$ groups so that their sums are equal.

You are given a positive integer $N$. Consider painting each of the $N$ numbers from $1$ to $N$ with $1$ color, either blue or red.
Determine whether there exists a way of painting such that the sum of the numbers painted blue equals the sum of the numbers painted red, and if one exists, show one example.

You are given $T$ test cases, so find the answer for each of them.

Input

The $1$st line of the input is as follows.
$T$
Then, $T$ test cases follow. Each of them is given in the following format.
$N$

  • $1 \leq T \leq 100$
  • $1 \leq N \leq 100$
  • All inputs are integers.

Output

If no way of painting satisfying the condition exists, print -1 followed by a newline.
If one exists, print a string of $N$ characters consisting of 0 and 1, followed by a newline. Here, the $i$-th character from the left being 0 means that $i$ is painted blue, and 1 means that $i$ is painted red.

Sample

Sample 1
Input
3
1
3
8
Output
-1
110
00100011

  • For the $1$st test case, no way of painting satisfies the condition.
  • For the $2$nd test case, the sum of the numbers painted blue is $3$, and the sum of the numbers painted red is $3 = 1+2$.
  • For the $3$rd test case, the sum of the numbers painted blue is $18 = 1+2+4+5+6$, and the sum of the numbers painted red is $18 = 3+7+8$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。