ujjawalrana001's blog

By ujjawalrana001, history, 7 weeks ago, In English

Hello codeforces! can anyone explain me the test case of this question ? Thanks in advance :)

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

»
7 weeks ago, # |
Rev. 7   Vote: I like it 0 Vote: I do not like it

consider the graph of the test case.

1    5
  |\    
  2  4  
  |
  3

you notice that number of groups is max number of levels which will be 3 in this case because: level 1: nodes 1,5. level 2 : nodes 2,4. level 3 : nodes 3.

which will form groups in it there are not any superior of another in same group. to calculate answer you will use bfs algorithm for graph .

hope it well.

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Thanks @beethoven97for helping me....yeah now it is clear :)

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    will it works if i approach the problem with height of the binary tree?

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    can you explain how to construct the tree in this particular problem? i guess this can be done only through graph adjacency list.