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

Автор lamda_cdm, история, 4 года назад, По-английски

I was trying this problem. Tried a greedy solution , where I number the nodes starting from the lower level . And take every leaf node one by one . Someway it's failing . I tried making counter test cases but couldn't find a case where my solution failed. Here's my link 196466553 to the submission . Problem 1740E - Hanging Hearts

Thanks in advance

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

»
4 года назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

counter test case :

Input: 
5
1 2 2 4

expected output : 4
your output : 3

values of vertices = [5 4 2 3 1]

I hope you can figure out, if not let me know.