結果
| 問題 | No.1382 Travel in Mitaru city |
| コンテスト | |
| ユーザー |
zjsdut
|
| 提出日時 | 2026-03-05 12:04:40 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 848 bytes |
| 記録 | |
| コンパイル時間 | 4,407 ms |
| コンパイル使用メモリ | 222,252 KB |
| 実行使用メモリ | 1,762,644 KB |
| 最終ジャッジ日時 | 2026-03-05 12:28:37 |
| 合計ジャッジ時間 | 30,535 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 2 MLE * 1 |
| other | TLE * 33 MLE * 26 -- * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, s, t;
cin >> n >> m >> s >> t;
s--; t--;
vector<int> p(n);
for (int i = 0; i < n; i++)
cin >> p[i];
vector<vector<int>> g(n);
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--; b--;
g[a].push_back(b);
g[b].push_back(a);
}
priority_queue<pair<int,int>> q;
q.push({p[s], s});
int minv = p[s];
int ans = 0;
while (!q.empty()) {
auto [val, u] = q.top();
q.pop();
if (val < minv) {
minv = val;
ans++;
}
for (int v : g[u]) {
q.push({p[v], v});
}
}
cout << ans << '\n';
}
zjsdut