結果
問題 |
No.3116 More and more teleporter
|
ユーザー |
|
提出日時 | 2025-04-06 21:40:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 501 bytes |
コンパイル時間 | 820 ms |
コンパイル使用メモリ | 84,568 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-16 01:17:13 |
合計ジャッジ時間 | 8,494 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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); } } }