Help with Candy Machine, BOI '09

Правка en2, от dhruvsomani, 2018-03-19 16:41:33

Hey, I could not understand the solution of a problem and I need some help.

Here's the problem I am talking about. BOI 2009, Candy Machine.

In this solution, I understood the O(n^2) algo with OWSP. Can you please explain what the O(n log n) solution (the code part) is doing.

Why is it sorting on basis of (t + p, t — p)? And what is the binary search on?

Please help. :)

Thanks.

Теги boi2009, candymachine, #sorting

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский dhruvsomani 2018-03-19 16:41:33 19 Tiny change: 'ch on?\n\nThanks' -> 'ch on?\n\nPlease help. :)\n\nThanks'
en1 Английский dhruvsomani 2018-03-18 21:03:47 524 Initial revision (published)