# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
120933 | 2019-06-25T18:33:45 Z | Runtime_error_ | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 4 ms | 2688 KB |
#include "crocodile.h" #include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> using namespace std; const int inf=1e5+9,MX=1e9+9; vector< pair<int,int> > adj[inf]; bool ex[inf],vis[inf]; //we have to use multi set because we might visit the same node twice with the same distance //multiset will time out so we use priority queue priority_queue<pair<int,int> > pq; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ for(int i=0;i<M;i++) adj[ R[i][0] ].push_back( make_pair( R[i][1] , L[i] ) ), adj[ R[i][1] ].push_back(make_pair( R[i][0] , L[i] )); for(int i=0;i<K;i++) ex[ P[i] ] = 1,pq.push(make_pair(0, P[i] )); while(!pq.empty()){ pair<int,int> p = pq.top(); pq.pop(); int u = p.second , dis = p.first; if( ex[u] == 0 ){ // we want the second minimum distance so when we reach a node that are not an exit for the first time we abort //and make that we visited it once ex[u] = 1; continue; } if(vis[u]) continue; vis[u] = 1; if( u == 0) return dis; for(auto v:adj[u]) pq.push(make_pair(dis+v.second,v.first)); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2688 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2688 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2688 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |