結果
| 問題 | No.2247 01 ZigZag |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-17 21:45:04 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 677 bytes |
| 記録 | |
| コンパイル時間 | 184 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 93,568 KB |
| 最終ジャッジ日時 | 2026-04-06 17:51:57 |
| 合計ジャッジ時間 | 3,331 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 49 WA * 1 |
ソースコード
import sys
input = sys.stdin.readline
from collections import *
def g(x):
l = [x]
for _ in range(K):
l.append(l[-1]^1)
return l
N, M, K = map(int, input().split())
l0, l1 = g(0), g(1)
if l0.count(0)<=N and l0.count(1)<=M:
l = l0
elif l1.count(0)<=N and l1.count(1)<=M:
l = l1
else:
exit(print(-1))
idx1, idx2 = -1, -1
for i in range(len(l)):
if l[i]==0:
if idx1==-1:
idx1 = i
else:
idx2 = i
ans = []
for i in range(len(l)):
ans.append(l[i])
if i==idx1:
ans += [0]*(N-l.count(0))
elif i==idx2:
ans += [1]*(M-l.count(1))
ans = ''.join(map(str, ans))
print(ans)