CHNGFUNC - Editorial

i submitted my solution during contest, it throws TLE at that time.
But when i copy pasted my code(exactly same) in practice section it gave me AC.can anyone explain why this happened?
https://www.codechef.com/viewsolution/14675999
https://www.codechef.com/viewsolution/14656596

i submitted my solution during contest, it throws TLE at that time.
But when i copy pasted my code(exactly same) in practice section it gave me AC.can anyone explain why this happened?
https://www.codechef.com/viewsolution/14675999
https://www.codechef.com/viewsolution/14656596

can you tell me the complexity of your solution?

My solution is a bit different.At first, I pre-computed all squares of numbers up to 10000002.Then for each square number let say x less than A*A,I searched how many square numbers are there in the region x+B.Here is my solution link.link text

In #Author’s solution why do we check for (k_plus_x + k_minus_x)%2==0 && (k_plus_x - k_minus_x)%2==0???

CHNGFUNC In #Author’s solution why do we check for (k_plus_x + k_minus_x)%2==0 && (k_plus_x - k_minus_x)%2==0 ???

i think this one is easy and simple to understand my solution which i tried after contest Time complexity: O(A) https://www.codechef.com/viewsolution/14762782

I used two pointer technique. First I stored all the squares till the maximum possible perfect square one can get in a vector. Then I used the difference of values of two pointer to check the condition |x^2-y^2|<=b.
My solution : https://www.codechef.com/viewsolution/17996226