結果

問題 No.1376 Simple LPS Problem
ユーザー qwewe
提出日時 2025-05-14 12:47:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 82,820 KB
実行使用メモリ 54,612 KB
最終ジャッジ日時 2025-05-14 12:47:29
合計ジャッジ時間 8,230 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())

if K == 1:
    if N == 1:
        print('0')
    else:
        print(-1)
elif K == 2:
    res = []
    for i in range(N):
        if (i // 2) % 2 == 0:
            res.append('0')
        else:
            res.append('1')
    print(''.join(res))
elif K % 2 == 0:
    if N < K:
        print(-1)
    else:
        half = K // 2
        first_half = '0' + '1' * (half - 1)
        palindrome = first_half + first_half[::-1]
        remaining = N - K
        if remaining > 0:
            palindrome += '1' + '0' * (remaining - 1)
        print(palindrome)
else:
    print(-1)
0