結果

問題 No.2247 01 ZigZag
ユーザー shakayamishakayami
提出日時 2023-03-17 21:45:19
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 776 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 81,760 KB
実行使用メモリ 844,980 KB
最終ジャッジ日時 2023-10-18 14:17:22
合計ジャッジ時間 3,153 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,388 KB
testcase_01 AC 38 ms
53,388 KB
testcase_02 MLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
権限があれば一括ダウンロードができます

ソースコード

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
    A=[0 for i in range(K+1)]
    for i in range(0,K+1,2):
        A[i]+=1
        N-=1
    if N<0:
        tmp=solve(Ncash,M-1,K-1)
        if tmp==-1:
            return tmp
        else:
            return "1"+tmp
    A[0]+=N
    for i in range(1,K+1,2):
        A[i]+=1
        M-=1
    if M<0:
        return -1
    A[K-(K+1)%2]+=M
    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