結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー shotoyooshotoyoo
提出日時 2020-12-10 01:28:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 609 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 63,488 KB
最終ジャッジ日時 2024-09-19 07:54:24
合計ジャッジ時間 3,269 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

    
n,k = list(map(int, input().split()))
s = input()
c = k # 0の個数
dp = [0]*(n+k)
for i in range(n-1,0,-1):
    if s[i-1]=="x":
        v = 0
    else:
        if c==k:
            v = 1
        else:
            v = 0
    dp[i] = v
    if v==0:
        c += 1
    if dp[i+k]==0:
        c -= 1
index = []
for i in range(1,k+1):
        if dp[i]!=0 and s[i-1]=="o":
            index.append(i)
if index:
    write("\n".join(map(str, index)))
else:
    print(0)
0