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

Автор PraveenDhinwa, 11 лет назад, По-английски

http://codeforces.com/contest/267/problem/B

Please help me in solving this problem. For me this looks like finding a hamlitonian path in a graph which is NP complete. Any hints for solving the problem ??

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

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

Let's consider dominoes as edges and values written on dominoes as 2 vertexes. In this case all you have to do is to find Eulerian path, that can be done in O(n+m).

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

Maybe this will be helpful. ;)