結果
| 問題 | No.3116 More and more teleporter |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-06 21:40:00 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 501 bytes |
| 記録 | |
| コンパイル時間 | 819 ms |
| コンパイル使用メモリ | 164,296 KB |
| 実行使用メモリ | 9,060 KB |
| 最終ジャッジ日時 | 2026-07-09 11:48:23 |
| 合計ジャッジ時間 | 11,782 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 2 -- * 17 |
ソースコード
#include <iostream>
#include <vector>
int main() {
int n, q;
std::cin >> n >> q;
const int INF = 2'000'000'000;
std::vector<int> cost(n, INF);
for (int i = 0; i < q; i++) {
int type, x;
std::cin >> type >> x;
x--;
if(type == 1) {
int ans = x;
for(int j = 0; j < n; j++) {
ans = std::min(ans, cost[j] + abs(x - j));
}
std::cout << ans << "\n";
} else {
int c;
std::cin >> c;
cost[x] = std::min(cost[x], c);
}
}
}