結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー rlangevinrlangevin
提出日時 2023-10-01 00:11:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 544 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 85,696 KB
最終ジャッジ日時 2023-10-01 00:11:45
合計ジャッジ時間 6,500 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,356 KB
testcase_01 AC 96 ms
71,504 KB
testcase_02 AC 92 ms
71,072 KB
testcase_03 AC 101 ms
71,508 KB
testcase_04 AC 93 ms
71,452 KB
testcase_05 AC 93 ms
71,484 KB
testcase_06 AC 92 ms
71,356 KB
testcase_07 AC 96 ms
71,308 KB
testcase_08 AC 91 ms
71,468 KB
testcase_09 AC 92 ms
71,472 KB
testcase_10 AC 92 ms
71,312 KB
testcase_11 AC 91 ms
71,156 KB
testcase_12 AC 91 ms
71,412 KB
testcase_13 AC 109 ms
84,984 KB
testcase_14 AC 119 ms
84,792 KB
testcase_15 AC 113 ms
84,988 KB
testcase_16 AC 119 ms
85,108 KB
testcase_17 AC 117 ms
85,096 KB
testcase_18 AC 116 ms
82,236 KB
testcase_19 AC 115 ms
81,876 KB
testcase_20 AC 106 ms
77,944 KB
testcase_21 AC 113 ms
80,860 KB
testcase_22 AC 109 ms
79,660 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 133 ms
84,944 KB
testcase_33 WA -
testcase_34 AC 111 ms
84,968 KB
testcase_35 AC 110 ms
85,168 KB
testcase_36 AC 111 ms
84,836 KB
testcase_37 AC 112 ms
84,828 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 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)
0