結果

問題 No.1376 Simple LPS Problem
ユーザー chineristACchineristAC
提出日時 2021-02-05 23:19:54
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 2,376 bytes
コンパイル時間 949 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 81,224 KB
最終ジャッジ日時 2023-09-15 10:50:54
合計ジャッジ時間 15,187 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 89 ms
71,904 KB
testcase_02 AC 93 ms
72,280 KB
testcase_03 WA -
testcase_04 RE -
testcase_05 AC 90 ms
71,908 KB
testcase_06 RE -
testcase_07 AC 89 ms
72,564 KB
testcase_08 AC 91 ms
72,484 KB
testcase_09 RE -
testcase_10 AC 91 ms
72,008 KB
testcase_11 RE -
testcase_12 AC 89 ms
72,224 KB
testcase_13 RE -
testcase_14 AC 91 ms
72,100 KB
testcase_15 RE -
testcase_16 AC 97 ms
72,144 KB
testcase_17 AC 91 ms
72,220 KB
testcase_18 RE -
testcase_19 AC 91 ms
71,968 KB
testcase_20 RE -
testcase_21 AC 88 ms
72,244 KB
testcase_22 RE -
testcase_23 AC 92 ms
71,896 KB
testcase_24 RE -
testcase_25 AC 89 ms
72,256 KB
testcase_26 AC 93 ms
72,008 KB
testcase_27 AC 89 ms
72,284 KB
testcase_28 AC 89 ms
72,372 KB
testcase_29 RE -
testcase_30 AC 91 ms
72,280 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 88 ms
72,300 KB
testcase_35 RE -
testcase_36 AC 91 ms
72,248 KB
testcase_37 RE -
testcase_38 AC 89 ms
72,288 KB
testcase_39 AC 90 ms
72,100 KB
testcase_40 AC 93 ms
71,956 KB
testcase_41 AC 91 ms
71,944 KB
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 89 ms
72,088 KB
testcase_45 AC 109 ms
79,248 KB
testcase_46 AC 103 ms
81,224 KB
testcase_47 AC 102 ms
80,412 KB
testcase_48 AC 104 ms
81,016 KB
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 AC 90 ms
72,280 KB
testcase_56 AC 92 ms
72,344 KB
testcase_57 AC 91 ms
72,500 KB
testcase_58 AC 101 ms
79,808 KB
testcase_59 RE -
testcase_60 AC 91 ms
72,020 KB
testcase_61 AC 91 ms
72,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import random

def test():
    res = [1,0,1,0,1]
    while True:
        ok = [True,True]
        n = len(res)
        if res[n-1]==res[n-4] and res[n-2]==res[n-3]:
            ok[res[n-5]] = False
        if n>=6 and res[n-1]==res[n-5] and res[n-2]==res[n-4]:
            ok[res[n-6]] = False
        if all(res[i]==1 for i in range(n-4,n)) and res[n-5]==0:
            ok[1] = False
        if all(res[i]==0 for i in range(n-4,n)) and res[n-5]==1:
            ok[0] = False
        if ok[0]:
            if not ok[1]:
                res.append(0)
            else:
                res.append(random.randint(0,99)%2)
        elif ok[1]:
            res.append(1)
        else:
            break
    return res

def test_p(N):
    res = [1,0,1,0]
    while True:
        res += [0,0,1,1,0,1]
        for n in range(len(res),len(res)-6,-1):
            for j in range(2):
                if res[n-j-1]!=res[n-5+j]:
                    break
            else:
                assert False
            for j in range(2):
                if res[n-j-1]!=res[n-6+j]:
                    break
            else:
                assert False

        if len(res) > 100:
            break
    return res

def test_3():
    res = [1,0,1]
    while True:
        ok = [True,True]
        n = len(res)
        if res[n-1]==res[n-2]:
            ok[res[n-3]] = False
        if n>=4 and res[n-1]==res[n-3]:
            ok[res[n-4]] = False
        if ok[0]:
            if not ok[1]:
                res.append(0)
            else:
                res.append(random.randint(0,99)%2)
        elif ok[1]:
            res.append(1)
        else:
            break
    return res

M = 0
case = 0
s = ""
while case:
    r = test_p(4)
    if len(r) > M:
        M = len(r)
        s = r
    #M = max(M,len(r))
    case -= 1

#print(M)
#print(s)

N,K = map(int,input().split())
assert K%2
if K%2==1:
    if K==1:
        if N==1:
            print(1)
        else:
            print(-1)
    elif K==3:
        if N<=8:
            s = [0,0,0,1,0,1,1,1]
            s = s[:N]
            for i in range(N):
                s[i] = str(s[i])
            print("".join(s))
        else:
            print(-1)
    else:
        s = [1-(i%2) for i in range(K)]
        s += [0,0,1,1,0,1] * (N//5 + 1)
        s = s[:N]
        for i in range(N):
            s[i] = str(s[i])
        print("".join(s))
0