Need some help regarding recent Div(1+2)E

Revision en1, by NTU_ICPC, 2025-04-08 14:18:54

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'm trying to use fft however.

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.

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://codeforces.me/contest/2084/problem/E

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English NTU_ICPC 2025-04-08 14:20:04 168
en1 English NTU_ICPC 2025-04-08 14:18:54 876 Initial revision (published)