結果

問題 No.2247 01 ZigZag
ユーザー shakayamishakayami
提出日時 2023-03-17 21:46:54
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 792 bytes
コンパイル時間 1,250 ms
コンパイル使用メモリ 81,544 KB
実行使用メモリ 483,220 KB
最終ジャッジ日時 2023-10-18 14:20:08
合計ジャッジ時間 5,678 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,432 KB
testcase_01 AC 37 ms
53,432 KB
testcase_02 AC 42 ms
59,712 KB
testcase_03 AC 63 ms
68,456 KB
testcase_04 AC 41 ms
59,416 KB
testcase_05 AC 44 ms
59,816 KB
testcase_06 AC 47 ms
63,524 KB
testcase_07 RE -
testcase_08 AC 50 ms
67,272 KB
testcase_09 AC 51 ms
68,452 KB
testcase_10 AC 42 ms
59,588 KB
testcase_11 AC 47 ms
63,532 KB
testcase_12 AC 45 ms
61,872 KB
testcase_13 AC 46 ms
62,512 KB
testcase_14 RE -
testcase_15 AC 45 ms
61,876 KB
testcase_16 AC 45 ms
62,320 KB
testcase_17 AC 54 ms
70,860 KB
testcase_18 AC 42 ms
59,652 KB
testcase_19 AC 42 ms
59,840 KB
testcase_20 AC 42 ms
59,480 KB
testcase_21 AC 45 ms
61,876 KB
testcase_22 AC 49 ms
65,004 KB
testcase_23 AC 46 ms
63,252 KB
testcase_24 AC 41 ms
59,680 KB
testcase_25 AC 50 ms
67,276 KB
testcase_26 AC 46 ms
63,544 KB
testcase_27 AC 42 ms
59,612 KB
testcase_28 AC 51 ms
69,428 KB
testcase_29 AC 52 ms
69,964 KB
testcase_30 AC 52 ms
69,428 KB
testcase_31 RE -
testcase_32 AC 53 ms
69,036 KB
testcase_33 AC 49 ms
64,600 KB
testcase_34 AC 47 ms
63,180 KB
testcase_35 AC 46 ms
61,876 KB
testcase_36 AC 51 ms
67,676 KB
testcase_37 AC 46 ms
62,500 KB
testcase_38 AC 46 ms
62,656 KB
testcase_39 AC 48 ms
64,224 KB
testcase_40 AC 45 ms
60,660 KB
testcase_41 AC 38 ms
53,464 KB
testcase_42 AC 38 ms
53,464 KB
testcase_43 AC 37 ms
53,464 KB
testcase_44 WA -
testcase_45 AC 55 ms
71,256 KB
testcase_46 AC 55 ms
71,256 KB
testcase_47 AC 38 ms
53,464 KB
testcase_48 AC 38 ms
53,464 KB
testcase_49 WA -
testcase_50 AC 37 ms
53,464 KB
testcase_51 AC 37 ms
53,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

'''
K+1個のブロック
a_0,...,a_K
a_i>=1

a_{2i}個の0
a_{2i+1}個の1
辞書順最小にするためには
a_0を極力大きく
a_2,a_4,...,a_{2i}を1
'''
def solve(N,M,K):
    if K==0:
        if N*M>0:
            return (-1)
        else:
            return ("0"*N+"1"*M)
    Ncash=N
    Mcash=M
    A=[0 for i in range(K+1)]
    for i in range(1,K+1,2):
        A[i]+=1
        M-=1
    if M<0:
        return -1
    A[K-(K+1)%2]+=M
    for i in range(0,K+1,2):
        A[i]+=1
        N-=1
    if N<0:
        tmp=solve(Ncash,Mcash-1,K-1)
        if tmp==-1:
            return tmp
        else:
            return "1"+tmp
    A[0]+=N
    res=[]
    for i in range(K+1):
        res.append(str(i%2)*A[i])
    return "".join(res)

n,m,k=map(int,input().split())
print(solve(n,m,k))
0