I used Mo’s Algorithm for this problem but I am getting TIME LIMIT EXCEEDED
for one test case. Rest are getting accepted. This is after doing coordinate compression on the input array.
Here’s my code (starts from line 42): https://cses.fi/paste/ec649550a7cf002116171a/
Problem: https://cses.fi/problemset/task/1734/
Can anyone please have a look and tell me if I am missing anything?