結果
| 問題 |
No.3116 More and more teleporter
|
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2025-04-19 00:41:59 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 919 bytes |
| コンパイル時間 | 6,024 ms |
| コンパイル使用メモリ | 333,364 KB |
| 実行使用メモリ | 12,784 KB |
| 最終ジャッジ日時 | 2025-04-19 00:42:09 |
| 合計ジャッジ時間 | 9,471 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 14 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
i64 op(i64 a, i64 b) {
return min(a, b);
}
i64 e() {
return INF;
}
int main() {
FAST_IO
auto ans = 0LL;
int N, Q;
cin >> N >> Q;
atcoder::segtree<i64, op, e> segL(N), segR(N);
for (int i = 0; i < Q; i++) {
int t;
cin >> t;
if (t == 1) {
int x;
cin >> x;
x--;
i64 v = x;
v = min(v, segL.prod(0, x) + x);
v = min(v, segR.prod(x + 1, N) - x);
cout << v << endl;
} else if (t == 2) {
int x;
i64 c;
cin >> x >> c;
x--;
segL.set(x, c - x);
segR.set(x, c + x);
}
}
}
hiromi_ayase