MACM's blog

By MACM, history, 6 years ago, In English

Hello every body good day to you . I'm trying to solve this problem and this Is my approach solution for this E. Shortest Path problem
can any one help me to solve it. I Want the idea not the code. thank in advance :).

UPD: I have successfully manged to solve this problem but with the half of its prof i can't mange to make my code faster my final time is 2556 ms :)

  • Vote: I like it
  • -21
  • Vote: I do not like it

| Write comment?
»
6 years ago, # |
  Vote: I like it -22 Vote: I do not like it

The real question is why are you wasting your time trying to solve a 2100 rated div2 E as a gray? You won't improve a slightest bit doing that.

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

Have you looked at this comment in the contest editorial? https://codeforces.me/blog/entry/1276?#comment-22691

If so, what other questions do you have about their solution?

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

Peace on You :D

just use "BFS" to get the answer and not take the third city that makes you walk at any "forbidden triplet" from the given input ,,

In queue

store the current city and previous one , and when you select a city to be the next check if these triple are "OK" , to check you need "Set Data Structure" to store forbidden triplet.