結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 90 ms
72,140 KB
testcase_02 AC 92 ms
71,992 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 93 ms
72,000 KB
testcase_06 WA -
testcase_07 AC 89 ms
71,988 KB
testcase_08 AC 93 ms
72,096 KB
testcase_09 WA -
testcase_10 AC 90 ms
72,160 KB
testcase_11 WA -
testcase_12 AC 92 ms
72,056 KB
testcase_13 WA -
testcase_14 AC 89 ms
72,296 KB
testcase_15 WA -
testcase_16 AC 90 ms
72,108 KB
testcase_17 AC 89 ms
72,132 KB
testcase_18 WA -
testcase_19 AC 90 ms
72,396 KB
testcase_20 WA -
testcase_21 AC 92 ms
72,220 KB
testcase_22 WA -
testcase_23 AC 90 ms
72,128 KB
testcase_24 WA -
testcase_25 AC 90 ms
72,012 KB
testcase_26 AC 92 ms
72,192 KB
testcase_27 AC 92 ms
72,152 KB
testcase_28 AC 90 ms
72,080 KB
testcase_29 WA -
testcase_30 AC 89 ms
71,972 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 90 ms
72,168 KB
testcase_35 WA -
testcase_36 AC 91 ms
72,456 KB
testcase_37 WA -
testcase_38 AC 91 ms
72,548 KB
testcase_39 AC 92 ms
72,228 KB
testcase_40 AC 90 ms
72,056 KB
testcase_41 AC 89 ms
72,092 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 92 ms
71,912 KB
testcase_45 AC 106 ms
79,428 KB
testcase_46 AC 106 ms
80,844 KB
testcase_47 AC 103 ms
80,172 KB
testcase_48 AC 104 ms
81,476 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 91 ms
72,080 KB
testcase_56 AC 90 ms
71,908 KB
testcase_57 AC 95 ms
72,332 KB
testcase_58 AC 102 ms
79,828 KB
testcase_59 WA -
testcase_60 AC 90 ms
72,512 KB
testcase_61 AC 89 ms
72,108 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,1,0,1]
    while True:
        res += [0,0,1,1,0,1]
        for n in range(len(res),len(res)-6,-1):
            for j in range((N+1)//2):
                if res[n-j-1]!=res[n-(N+1)+j]:
                    break
            else:
                assert False
            for j in range((N+1)//2):
                if res[n-j-1]!=res[n-(N+2)+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(7)
    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())
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