Alex7's blog

By Alex7, 11 years ago, In English

Hello, please help me find out why my code is getting WA in MTRAIN. My algorithm works this way... 1st BFS from Mirko and mark all edges he can visit. Then start another BFS from Slavko: Slavko can pass a certain edge E1 if there is an Edge E2 which Mriko can pass and the distance between both end points of E1 is <= d. There is a special case that Mirko can't go anywhere and Slavko can travel through edges around them so I calculate the distance between E1 and the starting point of Mirko. Another case is when E1 can be passed while Mirko travels through several edges so if the first test fails I try to do an reversed version where I bfs from Mirko's graph and see if I can reach 2 edges that are close to both end points respectively. Here is my code

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

please.. help me