結果

問題 No.2247 01 ZigZag
ユーザー first_vilfirst_vil
提出日時 2023-03-17 22:07:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 879 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,488 KB
実行使用メモリ 89,216 KB
最終ジャッジ日時 2023-10-18 14:58:44
合計ジャッジ時間 8,858 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,372 KB
testcase_01 AC 38 ms
53,372 KB
testcase_02 AC 37 ms
53,372 KB
testcase_03 AC 359 ms
79,340 KB
testcase_04 AC 38 ms
53,372 KB
testcase_05 AC 43 ms
61,296 KB
testcase_06 AC 115 ms
74,984 KB
testcase_07 AC 37 ms
53,372 KB
testcase_08 AC 235 ms
76,816 KB
testcase_09 AC 341 ms
79,068 KB
testcase_10 AC 38 ms
53,372 KB
testcase_11 AC 119 ms
74,984 KB
testcase_12 AC 58 ms
74,552 KB
testcase_13 AC 82 ms
74,660 KB
testcase_14 AC 38 ms
53,372 KB
testcase_15 AC 50 ms
74,548 KB
testcase_16 AC 73 ms
74,620 KB
testcase_17 AC 656 ms
88,240 KB
testcase_18 AC 37 ms
53,372 KB
testcase_19 AC 37 ms
53,372 KB
testcase_20 AC 37 ms
53,372 KB
testcase_21 AC 61 ms
74,552 KB
testcase_22 AC 190 ms
76,480 KB
testcase_23 AC 113 ms
74,952 KB
testcase_24 AC 37 ms
53,372 KB
testcase_25 AC 195 ms
76,816 KB
testcase_26 AC 101 ms
75,016 KB
testcase_27 AC 40 ms
59,240 KB
testcase_28 AC 340 ms
81,184 KB
testcase_29 AC 469 ms
84,012 KB
testcase_30 AC 326 ms
80,288 KB
testcase_31 AC 37 ms
53,372 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 38 ms
53,372 KB
testcase_42 AC 38 ms
53,372 KB
testcase_43 AC 39 ms
53,372 KB
testcase_44 AC 38 ms
53,372 KB
testcase_45 AC 655 ms
89,216 KB
testcase_46 AC 692 ms
89,216 KB
testcase_47 AC 38 ms
53,372 KB
testcase_48 AC 38 ms
53,372 KB
testcase_49 AC 38 ms
53,372 KB
testcase_50 AC 38 ms
53,372 KB
testcase_51 AC 38 ms
53,372 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:
                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)
0