Submission #5976

#TimeUsernameProblemLanguageResultExecution timeMemory
5976baneling100Computer Network (BOI14_network)C++98
0 / 100
128 ms5076 KiB
#include "network.h" int Ans[1001], Dist; int findBottom(int x) { int i; for(i=x ; i>=0 ; i--) if(Ans[i]) return i; return 0; } int findTop(int x) { int i; for(i=x ; i<=Dist+1 ; i++) if(Ans[i]) return i; return 0; } void findRoute (int N, int a, int b) { int i, x, y, c, d; Dist=ping(a,b); Ans[0]=a; Ans[Dist+1]=b; for(i=1 ; i<=N ; i++) if(i!=a && i!=b) { x=ping(a,i); c=findBottom(x); d=findTop(x+2); if(c==0) { if(d-x-2==ping(i,Ans[d])) Ans[x+1]=i; } else if(x-c==ping(Ans[c],i) && d-x-2==ping(i,Ans[d])) Ans[x+1]=i; } for(i=1 ; i<=Dist+1 ; i++) travelTo(Ans[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...