Блог пользователя MACM

Автор MACM, история, 6 лет назад, По-английски

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 :)

  • Проголосовать: нравится
  • -21
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится -22 Проголосовать: не нравится

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 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

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

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.