# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1041419 | HappyCapybara | Crocodile's Underground City (IOI11_crocodile) | C++17 | 1124 ms | 262144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include<bits/stdc++.h>
using namespace std;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
vector<vector<pair<int,int>>> g(N);
for (int i=0; i<M; i++){
g[R[i][0]].push_back({R[i][1], L[i]});
g[R[i][1]].push_back({R[i][0], L[i]});
}
vector<pair<int,int>> v(N, {pow(10, 9)+1, pow(10, 9)+1});
priority_queue<pair<int,int>> pq;
for (int i=0; i<K; i++) pq.push({0, P[i]});
vector<bool> seen(N, false);
while (!pq.empty()){
int d = -pq.top().first, cur = pq.top().second;
pq.pop();
if (seen[cur]) continue;
//cout << cur << " " << d << "\n";
if (cur == 0) return d;
for (pair<int,int> next : g[cur]){
if (d + next.second < v[next.first].first){
v[next.first].second = v[next.first].first;
v[next.first].first = d + next.second;
}
else if (d + next.second < v[next.first].second) v[next.first].second = d + next.second;
if (v[next.first].second < pow(10, 9)+1) pq.push({-v[next.first].second, next.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... |