FNCS - Editorial

Yeah you’re right about the distinct x part. Used it without knowing it!

1 ≤ Q,N ≤ 10^5. Worst case O(Q * N). Let’s say half of the queries are update queries. Then you would already have around 5 * 10^9 operations. That’s not something your computer can do in 2.5 seconds.