結果

問題 No.3116 More and more teleporter
ユーザー Naru820
提出日時 2025-04-10 02:30:27
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 6,148 ms
コンパイル使用メモリ 333,180 KB
実行使用メモリ 12,744 KB
最終ジャッジ日時 2025-04-10 02:30:38
合計ジャッジ時間 10,033 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ll n,q,t,x,c;
ll op(ll a, ll b){
    return min(a,b);
}
ll e(){
    return LLONG_MAX;
}
int main(){
    cin >> n >> q;
    vector<ll> a(n,1e18);
    segtree<ll,op,e> left(a),right(a);
    while(q--){
        cin >> t;
        if(t == 1){
            cin >> x;
            cout << min(x - 1,min(left.prod(0,x) + x,right.prod(x,n) - x)) << endl;
        }
        else{
            cin >> x >> c;
            left.set(x - 1,c - x);
            right.set(x - 1,c + x);
        }
    }
}
0