結果
問題 | No.2247 01 ZigZag |
ユーザー | ygd. |
提出日時 | 2023-03-17 21:52:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,597 bytes |
コンパイル時間 | 123 ms |
コンパイル使用メモリ | 82,224 KB |
実行使用メモリ | 100,036 KB |
最終ジャッジ日時 | 2024-09-18 16:08:30 |
合計ジャッジ時間 | 4,671 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
60,544 KB |
testcase_01 | AC | 46 ms
60,928 KB |
testcase_02 | AC | 43 ms
60,544 KB |
testcase_03 | AC | 72 ms
79,372 KB |
testcase_04 | AC | 44 ms
60,800 KB |
testcase_05 | AC | 64 ms
77,952 KB |
testcase_06 | AC | 73 ms
80,256 KB |
testcase_07 | AC | 43 ms
60,928 KB |
testcase_08 | AC | 80 ms
83,364 KB |
testcase_09 | AC | 75 ms
79,880 KB |
testcase_10 | AC | 44 ms
60,288 KB |
testcase_11 | AC | 72 ms
81,152 KB |
testcase_12 | AC | 66 ms
79,872 KB |
testcase_13 | AC | 68 ms
79,616 KB |
testcase_14 | AC | 43 ms
60,416 KB |
testcase_15 | AC | 66 ms
80,384 KB |
testcase_16 | AC | 80 ms
89,832 KB |
testcase_17 | AC | 95 ms
90,752 KB |
testcase_18 | AC | 43 ms
60,928 KB |
testcase_19 | AC | 43 ms
60,416 KB |
testcase_20 | AC | 46 ms
60,416 KB |
testcase_21 | AC | 57 ms
71,808 KB |
testcase_22 | AC | 84 ms
84,812 KB |
testcase_23 | AC | 75 ms
80,256 KB |
testcase_24 | AC | 48 ms
60,800 KB |
testcase_25 | AC | 83 ms
83,060 KB |
testcase_26 | AC | 81 ms
82,816 KB |
testcase_27 | AC | 71 ms
80,512 KB |
testcase_28 | AC | 82 ms
82,136 KB |
testcase_29 | AC | 87 ms
88,688 KB |
testcase_30 | AC | 94 ms
94,336 KB |
testcase_31 | AC | 46 ms
60,672 KB |
testcase_32 | AC | 86 ms
90,368 KB |
testcase_33 | AC | 77 ms
87,040 KB |
testcase_34 | AC | 61 ms
76,288 KB |
testcase_35 | AC | 57 ms
72,064 KB |
testcase_36 | AC | 75 ms
86,912 KB |
testcase_37 | AC | 54 ms
69,760 KB |
testcase_38 | AC | 54 ms
69,376 KB |
testcase_39 | AC | 58 ms
74,624 KB |
testcase_40 | AC | 44 ms
60,416 KB |
testcase_41 | AC | 54 ms
69,248 KB |
testcase_42 | AC | 57 ms
68,864 KB |
testcase_43 | AC | 47 ms
60,288 KB |
testcase_44 | AC | 45 ms
60,288 KB |
testcase_45 | AC | 101 ms
99,840 KB |
testcase_46 | AC | 101 ms
100,036 KB |
testcase_47 | AC | 44 ms
60,672 KB |
testcase_48 | AC | 44 ms
60,672 KB |
testcase_49 | AC | 43 ms
61,056 KB |
testcase_50 | AC | 45 ms
61,056 KB |
testcase_51 | WA | - |
ソースコード
import sys # input = sys.stdin.readline #input = sys.stdin.buffer.readline #文字列はダメ #sys.setrecursionlimit(1000000) import math import bisect #import itertools #import random #from heapq import heapify, heappop, heappush from collections import defaultdict from collections import deque import copy #DeepCopy: hoge = [_[:] for _ in hogehoge] #from functools import lru_cache #@lru_cache(maxsize=None) #MOD = pow(10,9) + 7 # MOD = 998244353 dx = [1,0,-1,0] dy = [0,1,0,-1] #dx8 = [1,1,0,-1,-1,-1,0,1] #dy8 = [0,1,1,1,0,-1,-1,-1] def main(): N,M,K = map(int,input().split()) if N == M: mx = N+M-1 else: mx = min(N,M) * 2 if mx < K: print(-1) exit() block0 = [[] for _ in range(K+1)] # 0 start N0 = N; M0 = M zero = True for i in range(K+1): if i%2 == 0: if N0 > 0: block0[i].append('0') N0 -= 1 else: zero = False break else: if M0 > 0: block0[i].append('1') M0 -= 1 else: zero = False break if zero: for _ in range(N0): block0[0].append('0') if (K+1)%2 == 0: #最後が1 for _ in range(M0): block0[-1].append('1') else: if (K+1)%2 == 1 and K+1 >= 2: for _ in range(M0): block0[-2].append('1') block0 = ["".join(block0[i]) for i in range(K+1)] z = "".join(block0) N1 = N; M1 = M one = True block1 = [[] for _ in range(K+1)] for i in range(K+1): if i%2 == 0: if M1 > 0: block1[i].append('1') M1 -= 1 else: one = False break else: if N1 > 0: block1[i].append('0') N1 -= 1 else: one = False break if one: if K+1 >= 2: for _ in range(N1): block1[1].append('0') if (K+1)%2 == 1: for _ in range(M1): block1[-1].append('1') elif K+1 >= 2: for _ in range(M1): block1[-2].append('1') block1 = ["".join(block1[i]) for i in range(K+1)] o = "".join(block1) if zero and one: print(min(z,o)) elif zero: print(z) elif one: print(o) else: print(-1) if __name__ == '__main__': main()