| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 99540 | jhnah917 | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 816 ms | 45292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include <vector>
#include <queue>
#include <utility>
using namespace std;
typedef pair<int, int> p;
vector<p> g[101010];
priority_queue<p> pq;
int dist1[101010], dist2[101010];
int visit[101010];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
for(int i=0; i<=N; i++) dist1[i] = dist2[i] = 1e9+7;
for(int i=0; i<M; i++){
int s = R[i][0], e = R[i][1], w = L[i];
g[s].push_back({e, w});
g[e].push_back({s, w});
}
for(int i=0; i<K; i++){
dist1[P[i]] = dist2[P[i]] = 0;
pq.push({0, P[i]});
}
while(!pq.empty()){
int now = pq.top().second, cost = -pq.top().first;
pq.pop();
if(visit[now]) continue;
visit[now] = 1;
for(auto i : g[now]){
int nxt = i.first, nxtCost = i.second;
if(visit[nxt]) continue;
//first
if(dist1[nxt] > dist2[now] + nxtCost){
dist2[nxt] = dist1[nxt];
dist1[nxt] = dist2[now] + nxtCost;
if(dist2[nxt] < 1e9+7) pq.push({-dist2[nxt], nxt});
}
//second
else if(dist2[nxt] > dist2[now] + nxtCost){
dist2[nxt] = dist2[now] + nxtCost;
pq.push({-dist2[nxt], nxt});
}
}
}
return dist2[0];
}
컴파일 시 표준 에러 (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... | ||||
