No.2247 01 ZigZag
レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 114
作問者 :
bayashiko
/ テスター :
kumakuma
Shirotsume
タグ : / 解いたユーザー数 114
作問者 :
bayashiko
/ テスター :
問題文最終更新日: 2023-03-11 01:18:04
English (AI translation)
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 381
(順位表)
の他の問題:
Problem Statement
Among the strings $S$ of length $N+M$ satisfying all of the following conditions, output the lexicographically smallest one.
- $S$ contains $N$
0s and $M$1s. - There are exactly $K$ integers $i(1\leq i \leq N+M-1)$ such that the $i$-th character and the $i+1$-th character of $S$ differ.
However, if there is not even $1$ string $S$ satisfying all of the conditions, output -1 instead.
Input
$N \ M \ K$
- $0\le N,M,K\le 10^5$
- $1 \leq N+M$
- All inputs are integers.
Output
Output the answer.
Sample
Sample 1
Input
2 1 1
Output
001
There are $2$ strings satisfying all of the conditions: 001 and 100. Of these, the lexicographically smaller one is 001, so the answer is 001.
Sample 2
Input
4 1 8
Output
-1
No string satisfies all of the conditions. Therefore, output -1.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。