# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
465521 | MohamedFaresNebili | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 543 ms | 66872 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "crocodile.h"
using namespace std;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
vector<pair<int, int>>adj[N]; vector<int> d(N, 0);
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>pq;
for(int l=0;l<M;l++) {
int a=R[l][0], b=R[l][1], w=L[l];
adj[a].push_back({b, w});
adj[b].push_back({a, w});
}
for(int l=0;l<K;l++) {
int a=P[l]; d[a]=1; pq.push({0, a});
}
vector<bool>vis(N, false);
while(!pq.empty()) {
int a=pq.top().second, w=pq.top().first; pq.pop();
if(d[a]==0) { d[a]=1; continue; }
if(vis[a]) continue; vis[a]=true;
if(a==0) return w;
for(auto u:adj[a]) {
int to=u.first, s=u.second;
if(vis[to]) continue;
pq.push({w+s, to});
}
}
return -1;
}
컴파일 시 표준 에러 (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... |