結果
問題 |
No.1376 Simple LPS Problem
|
ユーザー |
👑 ![]() |
提出日時 | 2021-02-05 22:18:27 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 967 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 62,720 KB |
最終ジャッジ日時 | 2024-07-02 12:48:33 |
合計ジャッジ時間 | 6,072 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 48 WA * 12 |
ソースコード
""" 001101 K = 1の場合 S = 2以下じゃないと無理 dpで解く? dpi = 現状回文になる可能性のある最長のi 偶数長と奇数長がある 両方に気を配る K = 5の時 6にも注意する必要がある 長さ3と4を同時に潰せる? 0110 → 無理 4と5は? 0XX11X0X0 長さ5と6は? """ import sys from sys import stdin N,K = map(int,stdin.readline().split()) if K == 1: if N == 1: print ("0") elif N == 2: print ("10") else: print (-1) sys.exit() elif N == K: print ("0"*K) sys.exit() ans = [None] * N for i in range(K): ans[i] = 0 ans[K] = 1 for i in range(K+1,N): a1 = ans[i-K] ^ 1 a2 = ans[i-(K+1)] ^ 1 if a1 != a2: print (-1) sys.exit() ans[i] = a1 print ("".join(map(str,ans))) """ if K == 1: if N == 1: print ("0") elif N == 2: print ("10") else: print (-1) elif K == 2: """