the_coder_8297's blog

By the_coder_8297, history, 2 months ago, In English

I didn't understand the editorial of the question.

https://mirror.codeforces.com/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.

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
2 months ago, # |
Rev. 2   Vote: I like it +2 Vote: I do not like it

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.