結果
問題 |
No.2247 01 ZigZag
|
ユーザー |
|
提出日時 | 2023-03-17 22:04:41 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 784 bytes |
コンパイル時間 | 350 ms |
コンパイル使用メモリ | 81,604 KB |
実行使用メモリ | 89,804 KB |
最終ジャッジ日時 | 2024-09-18 11:04:01 |
合計ジャッジ時間 | 8,444 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 WA * 10 |
ソースコード
n,m,k=map(int,input().split()) d=min(n,m)*2 if n!=m: d-=1 d=max(d,0) if d<k: print(-1) exit() def f(n,m,k): if n==0: return "" s="0" n-=1 for i in range(k): if ~i&1: if m==0: return "" else: s+="1" else: if n==0: return "" else: s+="0" return s s=f(n,m,k) if not s: s=f(m,n,k) s=s.replace("1","x").replace("0","1").replace("x","0") n-=s.count("0") m-=s.count("1") if n: for i in range(len(s)): if s[i]=="0": s=s[:i]+"0"*(n+1)+s[i+1:] break if m: for i in range(len(s))[::-1]: if s[i]=="1": s=s[:i]+"1"*(m+1)+s[i+1:] break print(s)