NTU_ICPC's blog

By NTU_ICPC, history, 13 months ago, In English

Firstly, apologies since I honestly don't know how to type latex. Anyways, most of us probably took part in the most recent Div(1+2) round, and E was kinda a bloodbath.

I read the editorial solution, and it seemed that many people used some form of fenwick to solve it. I definitely don't understand how, but I'm trying to use fft now..

The only difficulty now would be finding the coefficients for a fixed k. I could do so when at least one number <= k was present in the array. However it seems like I'm not so sure how it'd go if none were present. So for now, it seems my code will give the right answer if 0 was present in the initial array, and wrong one if it wasn't.

My current idea is that you have to iterate over >=k -1's. However that seems inefficient. Anyone could suggest a hint for me? Thanks.

I included my implementation here. The case I would need to complete is around line 150.

https://mirror.codeforces.com/contest/2084/problem/E

Full text and comments »

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