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

Автор the_coder_8297, история, 8 месяцев назад, По-английски

I didn't understand the editorial of the question.

https://codeforces.net/contest/1941/problem/G

Can anyone help me to get an idea of the solution, and why they are using these techniques to get the solution? How by using this we are getting the required answer.

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

»
8 месяцев назад, # |
Rev. 2   Проголосовать: нравится +2 Проголосовать: не нравится

In editorial, it asks you to make bipartite graph of stations and subway line. Once you reach a subway line, you can reach all the stations connected to it without incurring extra costs. Now how will you reach from source station to destination station?

Bipartite Graph for TC 1 and 2

Why is the answer of 1 -> 3 = 1 and 1 -> 6 = 2? Think about that.