Submission #5973

#TimeUsernameProblemLanguageResultExecution timeMemory
5973baneling100Computer Network (BOI14_network)C++98
25 / 100
124 ms8992 KiB
#include "network.h" int N, D[1001][1001], Check[1001], Path[1001], Cnt; void findPath(int left, int right) { int i; if(D[left][right]==0) return; for(i=1 ; i<=N ; i++) if(Check[i]==0) { if(D[left][i]==-1) D[left][i]=ping(left,i); if(D[i][right]==-1) D[i][right]=ping(i,right); if(D[left][right]==D[left][i]+D[i][right]+1) { Check[i]=1; findPath(left,i); Path[++Cnt]=i; findPath(i,right); break; } } } void findRoute (int n, int a, int b) { int i, j; N=n; for(i=1 ; i<=N ; i++) for(j=1 ; j<=N ; j++) D[i][j]=-1; Check[a]=Check[b]=1; D[a][b]=ping(a,b); findPath(a,b); Path[++Cnt]=b; for(i=1 ; i<=Cnt ; i++) travelTo(Path[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...