結果
| 問題 |
No.2247 01 ZigZag
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-08 14:39:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,005 bytes |
| コンパイル時間 | 277 ms |
| コンパイル使用メモリ | 81,860 KB |
| 実行使用メモリ | 71,096 KB |
| 最終ジャッジ日時 | 2024-09-18 06:52:58 |
| 合計ジャッジ時間 | 3,882 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 40 WA * 10 |
ソースコード
import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
INF = 2**63-1
mod = 998244353
n, m, k = mi()
assert 0 <= n <= 10 ** 5 and 0 <= m <= 10 ** 5 and 0 <= k <= 10 ** 5 and n + m >= 1
ans = '2'
#WA
#0101...型
s1 = deque(['0'])
cnt0 = 1
cnt1 = 0
for i in range(k):
if i % 2 == 0:
cnt1 += 1
s1.append('1')
else:
cnt0 += 1
s1.append('0')
if cnt0 <= n and cnt1 <= m:
while cnt0 < n:
if s1 and s1[0] == '1':
t = s1.popleft()
s1.appendleft('0')
s1.appendleft(t)
else:
s1.appendleft('0')
cnt0 += 1
while cnt1 < m:
if s1 and s1[-1] == '0':
t = s1.pop()
s1.append('1')
s1.append(t)
else:
s1.append('1')
cnt1 += 1
ans = min(ans, ''.join(s1))
if ans == '2':
print(-1)
else:
print(ans)