結果
問題 |
No.3116 More and more teleporter
|
ユーザー |
|
提出日時 | 2025-04-10 02:37:48 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 687 bytes |
コンパイル時間 | 5,157 ms |
コンパイル使用メモリ | 332,312 KB |
実行使用メモリ | 12,832 KB |
最終ジャッジ日時 | 2025-04-10 02:37:59 |
合計ジャッジ時間 | 8,833 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 14 |
ソースコード
#include<bits/stdc++.h> #include<atcoder/all> using namespace std; using ll = long long; using namespace atcoder; ll op(ll a, ll b) { return min(a, b); } const ll INF = 1LL << 60; ll e() { return INF; } ll n,q,t,x,c; int main(){ cin >> n >> q; vector<ll> init(n, INF); atcoder::segtree<ll, op, e> left(init), right(init); while(q--){ cin >> t; if(t == 1){ cin >> x; ll ans = x - 1; cout << min(x - 1,min(left.prod(0,x) + x,right.prod(x - 1,n) - x)) << "\n"; } else if(t == 2){ cin >> x >> c; left.set(x-1, c - x); right.set(x-1, c + x); } } }