https://www.codechef.com/problems/MKSMEVN/
Do I need to replace every i th element in the array with pow(A,p) and check for sum to be even? Is there any other method?
Asked by: harshitanand97 on March 27, 2021, 11:43 p.m. Last updated on March 27, 2021, 11:43 p.m.
It is written that chef can choose an index i
and replace A[i]
with A[i]^p
. And he has to perform the minimum number of such operations. So it's not necessary for him to perform an operation on each element.
Think it this way, that if he was to replace every element in the array like this, then the number of operations will always be n
. Which is definitely contradicting to the sample test cases provided.