結果
問題 |
No.1376 Simple LPS Problem
|
ユーザー |
![]() |
提出日時 | 2025-04-24 12:20:44 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 607 bytes |
コンパイル時間 | 172 ms |
コンパイル使用メモリ | 82,440 KB |
実行使用メモリ | 54,684 KB |
最終ジャッジ日時 | 2025-04-24 12:22:02 |
合計ジャッジ時間 | 8,151 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 WA * 30 |
ソースコード
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)