Hailo's blog

By Hailo, history, 8 years ago, In English

Hi, could someone help me solving the following problem? LINK

I've tried 2 solutions, one with complexity O(N^3 logN) using two mutlisets and other O(N^3 log^2N) using a BIT (I have the test cases and seams that this second solution runs faster). I got TLE with both approaches, so I came here to ask help. Hope someone could give me a better solution.

Thanks

  • Vote: I like it
  • +3
  • Vote: I do not like it