結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー trineutrontrineutron
提出日時 2020-05-26 18:57:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 721 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 73,972 KB
最終ジャッジ日時 2025-01-10 15:43:52
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

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