結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー H3PO4H3PO4
提出日時 2020-12-12 09:30:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 11,868 KB
実行使用メモリ 13,172 KB
最終ジャッジ日時 2023-10-20 01:59:14
合計ジャッジ時間 5,167 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
9,960 KB
testcase_01 AC 29 ms
9,960 KB
testcase_02 AC 29 ms
9,960 KB
testcase_03 AC 29 ms
9,960 KB
testcase_04 AC 30 ms
9,960 KB
testcase_05 AC 30 ms
9,960 KB
testcase_06 AC 30 ms
9,960 KB
testcase_07 AC 30 ms
9,960 KB
testcase_08 AC 29 ms
9,960 KB
testcase_09 AC 31 ms
9,960 KB
testcase_10 AC 31 ms
9,960 KB
testcase_11 AC 32 ms
9,960 KB
testcase_12 AC 29 ms
9,960 KB
testcase_13 AC 64 ms
13,172 KB
testcase_14 AC 81 ms
13,172 KB
testcase_15 AC 169 ms
13,172 KB
testcase_16 AC 184 ms
13,172 KB
testcase_17 AC 200 ms
13,172 KB
testcase_18 AC 119 ms
11,884 KB
testcase_19 AC 114 ms
11,800 KB
testcase_20 AC 42 ms
10,356 KB
testcase_21 AC 103 ms
11,452 KB
testcase_22 AC 66 ms
10,928 KB
testcase_23 AC 95 ms
11,680 KB
testcase_24 AC 38 ms
10,228 KB
testcase_25 AC 97 ms
11,872 KB
testcase_26 AC 32 ms
10,008 KB
testcase_27 AC 88 ms
11,244 KB
testcase_28 AC 167 ms
13,172 KB
testcase_29 AC 162 ms
13,172 KB
testcase_30 AC 160 ms
13,172 KB
testcase_31 AC 166 ms
13,172 KB
testcase_32 AC 148 ms
13,172 KB
testcase_33 AC 135 ms
13,172 KB
testcase_34 AC 144 ms
13,172 KB
testcase_35 AC 64 ms
13,172 KB
testcase_36 AC 94 ms
13,172 KB
testcase_37 AC 81 ms
13,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
S = [True] + [s == 'o' for s in input()]

while not S[-1]:
    S.pop()
N = len(S)

lst = [None] * N
lst[-1] = False
false_ct = 1
for i in range(N - 2, -1, -1):
    if i + K + 1 < N:
        false_ct -= not lst[i + K + 1]

    if not S[i]:
        lst[i] = True
        continue

    lst[i] = bool(false_ct)
    false_ct += not bool(false_ct)

if lst[0]:
    for i in range(1, K + 1):
        if not lst[i]:
            print(i)
            exit()
else:
    print(0)
0