# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
813476 | annabeth9680 | Crocodile's Underground City (IOI11_crocodile) | C++17 | 392 ms | 53532 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+5;
vector<pair<int,int>> adj[MAXN];
vector<int> dist[MAXN]; int vis[MAXN];
int travel_plan(int N, int M, int R[][2], int L[], int K, int exits[]){
for(int i = 0;i<M;++i){
adj[R[i][0]].push_back({L[i],R[i][1]});
adj[R[i][1]].push_back({L[i],R[i][0]});
}
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
for(int i = 0;i<K;++i){
dist[exits[i]].push_back(0); dist[exits[i]].push_back(0);
vis[exits[i]]++;
pq.push({0,exits[i]});
}
while(!pq.empty()){
int u = pq.top().second, cdist = pq.top().first; pq.pop();
if(vis[u] >= 2) continue;
vis[u]++;
if(vis[u] != 2) continue;
if(u == 0) return cdist;
for(auto p : adj[u]){
int cur = cdist+p.first, v = p.second;
if(dist[v].size() < 2){
dist[v].push_back(cur);
pq.push({cur,v});
}
else if(dist[v].size() == 2){
if(dist[v][0] > dist[v][1]) swap(dist[v][0],dist[v][1]);
if(dist[v][1] > cur){
dist[v].pop_back();
dist[v].push_back(cur);
pq.push({cur,v});
}
}
}
}
}
컴파일 시 표준 에러 (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... |