結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー t98slider
提出日時 2023-05-07 20:58:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 3,875 ms
コンパイル使用メモリ 232,640 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-24 19:53:59
合計ジャッジ時間 5,229 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;

int op(int lhs, int rhs){ return max(lhs, rhs); }
int e(){ return 0; }

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    string s;
    cin >> n >> k >> s;
    s = 'o' + s;
    atcoder::segtree<int, op, e> seg(vector<int>(n + 5, 1 << 30));
    seg.set(0, n - 1);
    for(int i = s.size() - 1, mexv; i >= 0; i--){
        if(s[i] == 'x') continue;
        seg.set(mexv = seg.max_right(0, [&](int v){return v <= i + k;}), i);
        if(mexv == 0 && i <= k){
            cout << i << '\n';
            exit(0);
        }
    }
}
0