# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
115525 | arnold518 | Crocodile's Underground City (IOI11_crocodile) | C++14 | 794 ms | 66312 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "crocodile.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 100000;
const ll INF = 1e15;
vector<pii> adj[MAXN+10];
pll dist[MAXN+10];
bool vis[MAXN+10];
struct Queue
{
int v;
ll w;
bool operator < (const Queue& p) const { return w>p.w; }
};
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
int i, j;
for(i=0; i<M; i++)
{
int u=R[i][0], v=R[i][1], w=L[i];
adj[u].push_back({v, w});
adj[v].push_back({u, w});
}
priority_queue<Queue> PQ;
for(i=0; i<N; i++) dist[i]={INF, INF};
for(i=0; i<K; i++) dist[P[i]]={0, 0}, PQ.push({P[i], 0});
while(!PQ.empty())
{
Queue T=PQ.top();
PQ.pop();
int now=T.v;
if(vis[now]) continue;
vis[now]=true;
for(pii nxt : adj[now])
{
if(dist[nxt.first].first>dist[now].second+nxt.second)
{
dist[nxt.first].second=dist[nxt.first].first;
dist[nxt.first].first=dist[now].second+nxt.second;
PQ.push({nxt.first, dist[nxt.first].second});
}
else if(dist[nxt.first].second>dist[now].second+nxt.second)
{
dist[nxt.first].second=dist[now].second+nxt.second;
PQ.push({nxt.first, dist[nxt.first].second});
}
}
}
return dist[0].second;
}
컴파일 시 표준 에러 (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... |