結果
問題 |
No.1313 N言っちゃダメゲーム (4)
|
ユーザー |
|
提出日時 | 2020-12-12 09:30:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 190 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 14,184 KB |
最終ジャッジ日時 | 2024-09-19 21:46:54 |
合計ジャッジ時間 | 4,401 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
N, K = map(int, input().split()) S = [True] + [s == 'o' for s in input()] while not S[-1]: S.pop() N = len(S) lst = [None] * N lst[-1] = False false_ct = 1 for i in range(N - 2, -1, -1): if i + K + 1 < N: false_ct -= not lst[i + K + 1] if not S[i]: lst[i] = True continue lst[i] = bool(false_ct) false_ct += not bool(false_ct) if lst[0]: for i in range(1, K + 1): if not lst[i]: print(i) exit() else: print(0)