ubercool's blog

By ubercool, history, 5 years ago, In English

I was solving tourists problem on kattis and keep on getting WA ,I can't understand what I am doing wrong.Here is a link to my code.The problem is asking for the sum of all paths between such vertex pair (x,y) where y>x and y%x is zero.

  • Vote: I like it
  • -6
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Assume that the tree is 1-2-...-200000. There are multiples of i, including i itself, in the range [1, 200000]. Therefore, each i adds to the answer. , so ans overflows.