# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
519950 | sliviu | 악어의 지하 도시 (IOI11_crocodile) | C++17 | 461 ms | 71084 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) {
vector<vector<pair<int, int>>> G(n);
vector<int> seen(n);
for (int i = 0;i < m;++i) {
int x, y;
G[r[i][0]].emplace_back(r[i][1], l[i]);
G[r[i][1]].emplace_back(r[i][0], l[i]);
}
auto comp = [&](pi a, pi b) {
return a.second > b.second;
};
priority_queue<pi, vector<pi>, decltype(comp)> PQ(comp);
for (int i = 0;i < k;++i) {
PQ.emplace(p[i], 0);
++seen[p[i]];
}
while (!PQ.empty()) {
int node, cost;
tie(node, cost) = PQ.top();
PQ.pop();
if (++seen[node] == 2) {
if (node == 0)
return cost;
for (auto x : G[node])
PQ.emplace(x.first, x.second + cost);
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |