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

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

Hello, Can anyone help me with this problem? After some days of thinking i notice that if we have popular cow A answer will be just all cows which A thinks is popular.But i have no idea how to find cow which is popular by every other.Can anyone help me?

Thank you.

P.S.any help on russian language are welcome...

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

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

Reverse graph and find all strongly connected components. Let's component C is first component in topological sort order. If you can reach all other components from C — all cows in C are "popular", otherwise there is no popular cows.