# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
426173 | chirathnirodha | 악어의 지하 도시 (IOI11_crocodile) | C++17 | 1 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Coded by Chirath Nirodha
#include "crocodile.h"
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define P push
typedef long long ll;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
vector<pair<ll,ll> > adj[N];
for(int i=0;i<M;i++){
adj[R[i][0]].PB(MP(R[i][1],L[i]));
adj[R[i][1]].PB(MP(R[i][0],L[i]));
}
ll shortest[N][2];
for(int i=0;i<N;i++)shortest[i][0]=shortest[i][1]=INT64_MAX;
priority_queue<pair<ll,ll> > q;
for(int i=0;i<K;i++){
shortest[P[i]][0]=shortest[P[i]][1]=0;
q.P(MP(0,P[i]));
}
while(!q.empty()){
int c=q.top().S;q.pop();
for(int i=0;i<adj[c].size();i++){
int a=adj[c][i].F;
ll len=adj[c][i].S;
ll pre=shortest[a][1];
if(shortest[a][0]>shortest[c][1]+len){
shortest[a][1]=shortest[a][0];
shortest[a][0]=shortest[c][1]+len;
}
else if(shortest[a][1]>shortest[c][1]+len)shortest[a][1]=shortest[c][1]+len;
if(shortest[a][1]<pre)q.P(MP(-shortest[a][1],a));
}
}
return shortest[0][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... |