結果

問題 No.2247 01 ZigZag
ユーザー first_vilfirst_vil
提出日時 2023-03-17 22:13:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 579 ms / 2,000 ms
コード長 921 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 89,300 KB
最終ジャッジ日時 2023-10-18 20:13:37
合計ジャッジ時間 9,094 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,456 KB
testcase_01 AC 38 ms
53,456 KB
testcase_02 AC 37 ms
53,456 KB
testcase_03 AC 289 ms
79,420 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 43 ms
61,356 KB
testcase_06 AC 106 ms
75,064 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 193 ms
76,896 KB
testcase_09 AC 282 ms
79,144 KB
testcase_10 AC 36 ms
53,460 KB
testcase_11 AC 97 ms
75,064 KB
testcase_12 AC 56 ms
74,632 KB
testcase_13 AC 79 ms
74,740 KB
testcase_14 AC 37 ms
53,460 KB
testcase_15 AC 50 ms
74,632 KB
testcase_16 AC 72 ms
74,700 KB
testcase_17 AC 540 ms
88,316 KB
testcase_18 AC 36 ms
53,460 KB
testcase_19 AC 36 ms
53,460 KB
testcase_20 AC 36 ms
53,460 KB
testcase_21 AC 59 ms
74,632 KB
testcase_22 AC 169 ms
76,560 KB
testcase_23 AC 107 ms
75,032 KB
testcase_24 AC 36 ms
53,460 KB
testcase_25 AC 208 ms
76,896 KB
testcase_26 AC 100 ms
75,096 KB
testcase_27 AC 40 ms
59,300 KB
testcase_28 AC 344 ms
81,264 KB
testcase_29 AC 462 ms
84,088 KB
testcase_30 AC 326 ms
80,368 KB
testcase_31 AC 36 ms
53,460 KB
testcase_32 AC 579 ms
84,732 KB
testcase_33 AC 221 ms
76,592 KB
testcase_34 AC 124 ms
75,156 KB
testcase_35 AC 65 ms
74,652 KB
testcase_36 AC 322 ms
78,704 KB
testcase_37 AC 71 ms
74,700 KB
testcase_38 AC 93 ms
74,824 KB
testcase_39 AC 201 ms
76,416 KB
testcase_40 AC 37 ms
53,460 KB
testcase_41 AC 37 ms
53,460 KB
testcase_42 AC 37 ms
53,460 KB
testcase_43 AC 37 ms
53,460 KB
testcase_44 AC 37 ms
53,460 KB
testcase_45 AC 564 ms
89,296 KB
testcase_46 AC 552 ms
89,300 KB
testcase_47 AC 38 ms
53,460 KB
testcase_48 AC 37 ms
53,460 KB
testcase_49 AC 38 ms
53,460 KB
testcase_50 AC 37 ms
53,460 KB
testcase_51 AC 37 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k=map(int,input().split())
if k==0:
    if min(n,m)==0:
        print("0"*n+"1"*m)
    else:
        print(-1)
    exit()
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:
                m-=1
                s+="1"
        else:
            if n==0:
                return ""
            else:
                n-=1
                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)
0