結果
問題 |
No.1376 Simple LPS Problem
|
ユーザー |
👑 ![]() |
提出日時 | 2021-02-05 22:54:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,311 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 82,236 KB |
実行使用メモリ | 71,424 KB |
最終ジャッジ日時 | 2024-07-02 13:42:24 |
合計ジャッジ時間 | 5,738 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 52 WA * 8 |
ソースコード
""" 001101 K = 1の場合 S = 2以下じゃないと無理 dpで解く? dpi = 現状回文になる可能性のある最長のi 偶数長と奇数長がある 両方に気を配る K = 5の時 6にも注意する必要がある 長さ3と4を同時に潰せる? 0110 → 無理 4と5は? 0XX11X0X0 長さ5と6は? 9,4はあるか? 11110010110010 やっぱりdp? 1111001010 11111000100 11011100000 1*K , 0*(K-2) , 1 , 0*((K-1)//2) 0*K , 1*(K-1)//2 , 0* K = 4 1111010000 K = 5 111110100000 K = 6 1111110011000000 """ import sys from sys import stdin N,K = map(int,stdin.readline().split()) ans = [1] * K + [0] * (K//3) + [1] * (K//3) + [0] * K if len(ans) < N: print (-1) else: print ("".join(map(str,ans[:N]))) """ 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: """