Comments

It is derived in the editorial. we got b(b+1) = c(c-1) by solving the 2 equations. Clearly, substituting c = b+1 in c(c-1) gives you b(b+1), hence c = b+1 is true.

In problem B, It's when an−1|an is maximum. And, since 0≤ai≤n, the maximum possible of value any ai|aj is ≤2n I don't understand how?

Thanks. Got the message.

I just saw that I won a branded t-shirt. Is it too late to update my old address?

You mean i*i <= 2*n - 1. We concluded that we need numbers that follow a^2=2b+1. You can think of this equation as squares which are odd and we don't want c or b to exceed n. From c = b+1, and a^2 = 2*b+1 implies a^2 = 2*c-1. Thus max value of a^2 can be 2*n-1. So in the loop we are counting all the a^2 less than 2*n-1 such that a is odd. You can see why it is more than 1 from simple maths.

In F, unordered_map gives TLE on test 11 on all the solutions of O(n^2), O(nlogn) and O(n). But using map works just fine. Why?

Actually implemented O(n*k) soln and it failed just 1 testcase.