結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー trineutrontrineutron
提出日時 2020-05-28 01:56:18
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 721 bytes
コンパイル時間 984 ms
コンパイル使用メモリ 87,404 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-20 15:11:59
合計ジャッジ時間 6,137 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,760 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 7 ms
4,380 KB
testcase_14 AC 7 ms
4,388 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cassert>

int main() {
    int n, k;
    std::string s;
    std::cin >> n >> k >> s;
    assert(1 <= k && k < n && n <= 200000);
    assert((int) s.size() == n - 1);
    for (char c : s) {
        assert(c == 'o' || c == 'x');
    }
    std::vector<bool> dp(n + k + 1); // declarer
    for (int i = n - 1; i >= 0; i--) {
        if (i > 0 && s.at(i - 1) == 'x') continue;
        dp.at(i) = true;
        for (int j = 1; j <= k; j++) {
            if (dp.at(i + j)) {
                dp.at(i) = false;
                break;
            }
        }
    }
    for (int i = 0; i <= k; i++) {
        if (dp.at(i)) {
            std::cout << i << std::endl;
        }
    }
}
0