結果
問題 | No.1313 N言っちゃダメゲーム (4) |
ユーザー |
![]() |
提出日時 | 2023-10-01 00:11:37 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 544 bytes |
コンパイル時間 | 885 ms |
コンパイル使用メモリ | 81,704 KB |
実行使用メモリ | 86,708 KB |
最終ジャッジ日時 | 2024-07-23 17:50:12 |
合計ジャッジ時間 | 4,205 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 10 |
ソースコード
from collections import * N, K = map(int, input().split()) S = [1] + [int(s == "o") for s in input()] + [0] ans = [-1] * (N + 1) ans[-1] = 0 val = 0 Q = deque([0]) for i in range(N - 1, 0, -1): if S[i] == 0: continue if i + K + 1 <= N and S[i]: val -= Q.popleft() if val: ans[i] = 0 else: ans[i] = 1 val += ans[i] Q.append(ans[i]) ans2 = [] for i in range(1, K + 1): if ans[i] == 1: ans2.append(i) if ans2: for a in ans2: print(a) else: print(0)