結果

問題 No.2247 01 ZigZag
ユーザー 👑 timitimi
提出日時 2023-03-17 21:57:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 1,005 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 111,080 KB
最終ジャッジ日時 2023-10-18 20:11:09
合計ジャッジ時間 5,039 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,584 KB
testcase_01 AC 36 ms
53,584 KB
testcase_02 AC 82 ms
97,780 KB
testcase_03 AC 92 ms
93,844 KB
testcase_04 AC 51 ms
74,308 KB
testcase_05 AC 62 ms
75,632 KB
testcase_06 AC 76 ms
86,396 KB
testcase_07 AC 49 ms
70,332 KB
testcase_08 AC 93 ms
94,904 KB
testcase_09 AC 92 ms
94,260 KB
testcase_10 AC 54 ms
79,116 KB
testcase_11 AC 80 ms
87,772 KB
testcase_12 AC 66 ms
81,776 KB
testcase_13 AC 62 ms
78,256 KB
testcase_14 AC 49 ms
70,904 KB
testcase_15 AC 66 ms
79,112 KB
testcase_16 AC 75 ms
89,444 KB
testcase_17 AC 110 ms
103,640 KB
testcase_18 AC 56 ms
81,220 KB
testcase_19 AC 83 ms
97,516 KB
testcase_20 AC 52 ms
75,124 KB
testcase_21 AC 58 ms
74,276 KB
testcase_22 AC 96 ms
97,016 KB
testcase_23 AC 75 ms
85,804 KB
testcase_24 AC 57 ms
83,052 KB
testcase_25 AC 93 ms
94,904 KB
testcase_26 AC 83 ms
93,052 KB
testcase_27 AC 64 ms
78,672 KB
testcase_28 AC 103 ms
102,008 KB
testcase_29 AC 96 ms
96,600 KB
testcase_30 AC 102 ms
99,584 KB
testcase_31 AC 47 ms
67,780 KB
testcase_32 AC 92 ms
98,556 KB
testcase_33 AC 61 ms
81,312 KB
testcase_34 AC 59 ms
77,548 KB
testcase_35 AC 53 ms
69,728 KB
testcase_36 AC 63 ms
83,612 KB
testcase_37 AC 51 ms
69,404 KB
testcase_38 AC 51 ms
69,404 KB
testcase_39 AC 56 ms
77,672 KB
testcase_40 AC 82 ms
97,516 KB
testcase_41 AC 37 ms
53,584 KB
testcase_42 AC 37 ms
53,584 KB
testcase_43 AC 36 ms
53,584 KB
testcase_44 AC 37 ms
53,584 KB
testcase_45 AC 116 ms
111,080 KB
testcase_46 AC 117 ms
111,080 KB
testcase_47 AC 36 ms
53,584 KB
testcase_48 AC 37 ms
53,584 KB
testcase_49 AC 37 ms
53,584 KB
testcase_50 AC 37 ms
53,584 KB
testcase_51 AC 37 ms
53,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K=map(int, input().split())
if M==0:
  if K==0:
    print('0'*N)
  else:
    print(-1)
  exit()

if N==0:
  if K==0:
    print('1'*M)
  else:
    print(-1)
  exit()
  
if K==0:
  print(-1)
  exit()
  
a,b=N,M  
A=[['0',1]]
C=[]
a-=1
for i in range(K):
  if i%2==0:
    A.append(['1',1])
    b-=1
  else:
    A.append(['0',1])
    a-=1

if a>=0 and b>=0:
  for i in range(2):
    if A[i][0]=='0':
      A[i][1]+=a 
  for i in range(2):
    if A[-1-i][0]=='1':
      A[-1-i][1]+=b 
  B=[]
  for a,b in A:
    for i in range(b):
      B.append(a)
  B=''.join(B)
  C.append(B)
  
a,b=N,M 
A=[['1',1]]
b-=1
for i in range(K):
  if i%2==0:
    A.append(['0',1])
    a-=1
  else:
    A.append(['1',1])
    b-=1

if a>=0 and b>=0:
  for i in range(2):
    if A[i][0]=='0':
      A[i][1]+=a 
  for i in range(2):
    if A[-1-i][0]=='1':
      A[-1-i][1]+=b 
  B=[]
  for a,b in A:
    for i in range(b):
      B.append(a)
  B=''.join(B)
  C.append(B)
if len(C)==0:
  print(-1)
else:
  C=sorted(C)
  print(C[0])
0