I tried to implement the problem using segment tree and multisets. I got a verdict of TLE. How can I optimize my code? Or is there a better solution?
Problem link: http://www.spoj.com/problems/KQUERY2/en/
Solution link: http://ideone.com/gDAmUW
Data Structure Problem: How do I optimize my solution for SPOJ KQUERY2 — K-query II?
I tried to implement the problem using segment tree and multisets. I got a verdict of TLE. How can I optimize my code? Or is there a better solution?
Problem link: http://www.spoj.com/problems/KQUERY2/en/
Solution link: http://ideone.com/gDAmUW
Rev. | Lang. | By | When | Δ | Comment | |
---|---|---|---|---|---|---|
en1 | Tobby_And_Friends | 2016-09-06 20:10:09 | 334 | Initial revision (published) |