ARRGAME2 - Editorial

In your code the values of a[i],b[i] can be till 10^9. Those will not fit in integer type.See the below link for clarity.

http://www.cplusplus.com/reference/climits/

Your approach is O(n^2) which will time out with the given constraints.You can improve it to O(nlogn)by sorting the array and using binary search.

The binary search in your code is the cause I guessā€¦
Even I had same problem with my code, when there is repetition of numbers in the array, binary search may give you an index between the range of indices of that numberā€¦

I have thoroughly checked my binary search. Repetitions have been handled properly. And I could not understand " binary search may give you an index between the range of indices of that number"ā€¦
@atulsehgal: Please give a test case which fails my codeā€¦??
@djdolls : Please look into my codeā€¦

do like (x/logx) < (y/logy)  in floating point
exclude , 1 from both the array and keep cnt of 1 from B array since for this all A >1 satisfy
https://www.codechef.com/viewsolution/1013928486