Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Comments
On shaanknightCodeCraft-20 (Div. 2), 4 years ago
+6

p --->number is divisible by p.

np -->number is not divisible by p.

A=[p,p,p,p,p,np]

B=[p,p,p,p,p,p,p,p,p,np]

Say the first index in array A having np is i,and first index in array B having np is j. We claim that answer is i+j.

Let's pick a element which has index greater than i and not divisible by p from Array A, now, we are forced to pick a element having index less than j of Array B ,in order to get the sum equals to i+j. Now, A[i]*B[j] will be divisible by p,since B[j] is divisible by p. Therefore we can't pick two elements , both of them who are not divisible by p,and the sum of indices being i+j.

I hope ,this is the logic behind the soln.

On shaanknightCodeCraft-20 (Div. 2), 4 years ago
+4

How can it be proved that the sum is not divisible by p. Say, we get the individual sum as x and p-x , which are not divisible by p. But their sum is divisible by p.

Or,Is this case not possible at all?