結果
問題 |
No.2247 01 ZigZag
|
ユーザー |
|
提出日時 | 2023-03-17 21:45:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 677 bytes |
コンパイル時間 | 247 ms |
コンパイル使用メモリ | 82,040 KB |
実行使用メモリ | 93,824 KB |
最終ジャッジ日時 | 2024-09-18 16:06:47 |
合計ジャッジ時間 | 4,013 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)