# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
775803 | NoLove | 악어의 지하 도시 (IOI11_crocodile) | C++17 | 561 ms | 69588 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e18;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
// process input
vector<pair<int, int>> adj[N];
for (int i = 0; i < M; i++) {
adj[R[i][0]].push_back({R[i][1], L[i]});
adj[R[i][1]].push_back({R[i][0], L[i]});
}
// // {T2, T1} (T1 < T2)
pair<int, int> dp[N + 1]; // dp[i]: minumum time from node i to escape
memset(dp, 0x3f3f3f, N*sizeof(dp[0]));
// dijkstra
set<pair<int, int>> q;
for (int i = 0; i < K; i++) {
q.insert({0, P[i]});
dp[P[i]] = {0, 0};
}
while (q.size()) {
int v = q.begin()->second;
int c = q.begin()->first;
q.erase(q.begin());
if (c != dp[v].first) continue;
for (auto[u, cost] : adj[v]) {
if (dp[v].first + cost < dp[u].first) {
if (dp[v].first + cost < dp[u].second) {
dp[u].first = dp[u].second;
dp[u].second = dp[v].first + cost;
} else {
dp[u].first = dp[v].first + cost;
}
q.insert({dp[u].first, u});
}
}
}
return dp[0].first;
}
컴파일 시 표준 에러 (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... |