|
0
For 1719B, i.e. Mathematical Circus, I made an array A storing all numbers from 1 to n, and another array B storing all numbers from 1+k to n+k. Now I look up for numbers in the two lists that are divisible by 4 with a condition that is A[i] is selected then A[i}+k i.e B[i] will not be considered. Now I count the number of such numbers. If it is equal to n/2 then it is true, because we get n/2 numbers that are divisible by 4.Now I pair them up with any of the remaining elements in the array A. This gives us our required pairs. This approach works great for the given input in the question and also passes pretest 1 but fails in pretest 2. Can anyone please help me figure out the issue. |