問題一覧 > 通常問題

No.873 Binary, Yabai-nari! lol

レベル : / AI推定難易度 : 1700 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 77
作問者 : tatyam / テスター : Shuz*
お気に入りにしたユーザー ProblemId : 2743 / 自分の提出
問題文最終更新日: 2019-08-17 00:51:41
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 221 (順位表) の他の問題:

Problem Statement

A binary is defined as "a string consisting only of 0 and 1".
A 01-sequence is defined as "a binary in which adjacent characters are different".
The yabasa of a binary is defined as "the sum of the squares of the lengths of the 01-sequences obtained by splitting the binary at the places where the same character occurs consecutively".
For example, "01011011000" is split into "0101" , "101" , "10" , "0" , "0", and its yabasa is $4^2+3^2+2^2+1^2+1^2=31$.
You are given a positive integer $N$. Find the shortest binary among those whose yabasa is $N$.
If there are multiple answers, find the lexicographically smallest one among them.

Input

$N$

The input is given as an integer.
$1\leq N\leq 3 \times 10^5$

Output

Print a newline at the end.

Sample

Sample 1
Input
1
Output
0

The binaries whose yabasa is 1 are "0" and "1". Both have length 1, and the lexicographically smallest one, "0", is printed.

Sample 2
Input
5
Output
001

Sample 3
Input
32
Output
01011010

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