結果

問題 No.3116 More and more teleporter
ユーザー Naru820
提出日時 2025-04-10 02:27:59
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 5,262 ms
コンパイル使用メモリ 332,664 KB
実行使用メモリ 12,600 KB
最終ジャッジ日時 2025-04-10 02:28:09
合計ジャッジ時間 9,154 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 22
権限があれば一括ダウンロードができます

ソースコード

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;
    segtree<ll,op,e> left(n),right(n);
    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