結果
| 問題 | No.2247 01 ZigZag |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-17 21:49:44 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 659 ms / 2,000 ms |
| コード長 | 669 bytes |
| 記録 | |
| コンパイル時間 | 166 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 300,544 KB |
| 最終ジャッジ日時 | 2026-04-06 17:52:24 |
| 合計ジャッジ時間 | 6,610 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)