fernandezpalomojosue's blog

By fernandezpalomojosue, history, 7 months ago, In English

On example,2nd test case, in the third query already exist a path with distances 3 between 2 leaves , 5-4-2-3, but the answer wasn't "-1 -1 -1".Am I receiving WA veredict for that? Submision:233191318.

»
7 months ago, # |
  Vote: I like it +16 Vote: I do not like it

your code is doing wrong when 4 is reppearing, in that case ur tree is

1-2-3-5

1-2-4

there is no 2 leaf nodes with distance 4.