結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー shotoyoo
提出日時 2020-12-10 01:18:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 82,272 KB
実行使用メモリ 76,876 KB
最終ジャッジ日時 2024-09-19 07:43:39
合計ジャッジ時間 2,962 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 11
権限があれば一括ダウンロードができます

ソースコード

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 = 1 # 0の個数
dp = [None]*(n)
dp[n-1] = 0
for i in range(n-2,0,-1):
    if s[i]=="x":
        v = 0
    else:
        if c>0:
            v = 1
        else:
            v = 0
    dp[i] = v
    if v==0:
        c += 1
    if i+k<n and 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