survival_001's blog

By survival_001, history, 6 years 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

| Write comment?
»
6 years ago, hide # |
← 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.