結果

問題 No.3116 More and more teleporter
ユーザー t98slider
提出日時 2025-05-11 17:47:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 4,101 ms
コンパイル使用メモリ 250,964 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-05-11 17:47:18
合計ジャッジ時間 7,456 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, Q, cmd, x, c;
    cin >> N >> Q;
    atcoder::segtree<int, op, e> seg(N);
    while(Q--){
        cin >> cmd >> x;
        x--;
        if(cmd == 1){
            cout << x - seg.prod(0, x + 1) << '\n';
        }else{
            cin >> c;
            seg.set(x, max(seg.get(x), x - c));
        }
    }
}
0