제출 #373947

#제출 시각아이디문제언어결과실행 시간메모리
373947urd05철로 (IOI14_rail)C++14
30 / 100
3093 ms197768 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; int n; typedef pair<int,int> P; typedef pair<P,int> Pi; bool vis[5000]; void findLocation(int N, int first, int location[], int stype[]) { n=N; priority_queue<Pi,vector<Pi>,greater<Pi>> pq; location[0]=first; stype[0]=1; for(int i=1;i<N;i++) { int got=getDistance(0,i); pq.push(Pi(P(got,first+got),-i)); } vis[0]=true; while (!pq.empty()) { Pi now=pq.top(); pq.pop(); int type=1; if (now.second<0) { type=2; now.second=-now.second; } if (vis[now.second]) { continue; } vis[now.second]=true; stype[now.second]=type; location[now.second]=now.first.second; for(int i=0;i<n;i++) { if (vis[i]) { continue; } int got=getDistance(now.second,i); pq.push(Pi(P(got,location[now.second]+got*(type==1?1:-1)),i*(type==1?-1:1))); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...