結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー rlangevinrlangevin
提出日時 2023-10-01 00:15:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 1,617 ms
コンパイル使用メモリ 86,392 KB
実行使用メモリ 85,260 KB
最終ジャッジ日時 2023-10-01 00:15:14
合計ジャッジ時間 7,182 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,304 KB
testcase_01 AC 102 ms
71,404 KB
testcase_02 AC 105 ms
71,124 KB
testcase_03 AC 102 ms
71,280 KB
testcase_04 AC 97 ms
71,340 KB
testcase_05 AC 99 ms
71,292 KB
testcase_06 AC 101 ms
71,208 KB
testcase_07 AC 101 ms
71,380 KB
testcase_08 AC 103 ms
71,332 KB
testcase_09 AC 101 ms
71,428 KB
testcase_10 AC 100 ms
71,380 KB
testcase_11 AC 101 ms
71,172 KB
testcase_12 AC 99 ms
71,296 KB
testcase_13 AC 121 ms
84,732 KB
testcase_14 AC 126 ms
85,112 KB
testcase_15 AC 129 ms
84,940 KB
testcase_16 AC 130 ms
84,800 KB
testcase_17 AC 125 ms
84,940 KB
testcase_18 AC 123 ms
82,168 KB
testcase_19 AC 122 ms
81,868 KB
testcase_20 AC 114 ms
77,776 KB
testcase_21 AC 118 ms
80,848 KB
testcase_22 AC 115 ms
79,228 KB
testcase_23 AC 125 ms
81,324 KB
testcase_24 AC 117 ms
77,904 KB
testcase_25 AC 149 ms
82,164 KB
testcase_26 AC 110 ms
77,036 KB
testcase_27 AC 118 ms
80,476 KB
testcase_28 AC 132 ms
84,840 KB
testcase_29 AC 127 ms
84,988 KB
testcase_30 AC 129 ms
84,776 KB
testcase_31 AC 129 ms
84,932 KB
testcase_32 AC 132 ms
84,932 KB
testcase_33 AC 134 ms
85,032 KB
testcase_34 AC 146 ms
85,260 KB
testcase_35 AC 128 ms
84,856 KB
testcase_36 AC 133 ms
85,252 KB
testcase_37 AC 133 ms
85,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 i + K + 1 <= N:
        val -= Q.popleft()
    if val or S[i] == 0:
        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)
0