Submission #16375

#TimeUsernameProblemLanguageResultExecution timeMemory
16375suhgyuho_williamComputer Network (BOI14_network)C++98
100 / 100
157 ms5204 KiB
#include "network.h" #include <queue> using namespace std; int d[1002],p[1002]; priority_queue <pair<int,int> > q; void findRoute (int n, int a, int b) { int dist = ping(a,b); int i,x,last=b; pair<int,int> top; d[b]=dist; for(i=1;i<=n;i++){ if(i==a || i==b) continue; x=ping(a,i); if(x>=dist) continue; q.push(make_pair(x,i)); d[i]=x; } q.push(make_pair(-1,a)); while(!q.empty()){ top=q.top(); q.pop(); if(d[last] == top.first) continue; if(ping(top.second,last)==0){ p[d[last]]=last; last=top.second; } } for(i=0;i<=dist;i++){ travelTo(p[i]); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...