Comments
0

Waiting for the tutorial

Problem A

If your n is even :

Say you have:

n=6

[a,b,c,d,e,f]

a^b^c^d^e^f =X

[X,X,X,X,X,X]

Now if you do the operation one more time on the entire array,

X^X^X^X^X^X= 0

[0,0,0,0,0,0]

So the no of operations used are 2. (1 to n) (1 to n)

If your n is Odd:

Say n is 5

[a,b,c,d,e]

a^b^c^d^e=U

[U,U,U,U,U]

So U^U^U^U^U=U [U,U,U,U,U]

SO WHAT WE DO IS : IF YOUR N IS ODD WE XOR 1 to N-1 and again N-1 to N

[a,b,c,d,e]

So a^b^c^d=U

[U,U,U,U,e]

And now again from 1 to n-1 U^U^U^U=0

SO ARRAY BECOMES

[0,0,0,0,e]

NOW from n-1 to n

0^e=e

[0,0,0,e,e]

Again n-1 to n

e^e=0

SO NOW IT BECOMES

[0,0,0,0,0]

So if n is odd then output 4 (1 to n-1) (1 to n-1) (n-1 to n) (n-1 to n)

0

In this entire duration i somehow managed to solve A,wt shall i do, i am really getting depressed,i am soo weak, wt do i need to practice in order to be able to be good at cp .

On pinelyPinely Round 2, 3 years ago
0

Thanks man! I will keep learning!

On pinelyPinely Round 2, 3 years ago
0

It's was my second time i participated,i tried to solve A for 3 hours but i couldn't same happened with me in the first contest ,and now i feel very demotivated , i feel myself very weak, what shall i do? Please help.