結果
| 問題 |
No.2247 01 ZigZag
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-17 21:49:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,161 ms / 2,000 ms |
| コード長 | 669 bytes |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 259,076 KB |
| 最終ジャッジ日時 | 2024-09-18 16:07:51 |
| 合計ジャッジ時間 | 10,237 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 50 |
ソースコード
n,m,k = map(int,input().split())
num = min(n,m)*2 - (n==m)
if k == 0:
if n != 0 and m != 0:
print(-1)
exit()
else:
ans = "0"*n + "1"*m
print(ans)
exit()
if num < k:
print(-1)
exit()
elif num == k:
if n >= m:
l = [0,1] *( (k+1)//2 )
else:
l = [1,0] * ((k+1)//2)
if k % 2 == 0:
l.append(l[0])
else:
l = [0,1] *( (k+1)//2 )
if k % 2 == 0:
l.append(l[0])
cnt = [1]*len(l)
n -= l.count(0)
m -= l.count(1)
for i in range(len(l)):
if l[i] == 0:
cnt[i] += n
break
for i in range(len(l))[::-1]:
if l[i] == 1:
cnt[i] += m
break
ans = ""
for i in range(len(l)):
ans += str(l[i]) * cnt[i]
print(ans)