Contest is over .I was getting TLE
Plz help with these questions!
Hello @Bhawna, out of these in which ques you were using big factorials concept the one you tagged ??
No big Factorials is not the topic ,these are questions from other test ,I got TLE in 3 question Help me to optimize.
Tell the logic and what were you doing code ??
I was doing bruteforce .
I was taking xor Of 2 elements and then putting new element in vector and repeating it k times
Just try to observe the pattern, after 1 operation the first element will be a1^a2
after 3 operations the first element will be a1^a2^a3^a4
after 7 operations the first element will be a1^a2^a3^a4^a5^a6^a7^a8
after 15 operations the first element will be a1^a2^a3^a4^a5^a6^a7^a8^a9^a10^a11^a12^a13^a14^a15^a16
So may be you are also observing a pattern here after k = 2^x-1 operations the element value will become the xor of all the elements from ai…ai+k
After this if the k is greater than some 2^x-1 we can replace our array with the new one and reduce the value of k as well to k -= 2^x-1 and then start doing operations on the new one.
I didn’t understand this part.
Sir,I also didn’t understand 2nd question that how to minimize number of matches to finish the tournament and what should be the correct arrangement to do so?
Have you tried by writing what will be the result after k operations? Pls, do this for k = 15 or k = 7. Some type of pattern you will see.
I got that for odd number of operations or odd value of k ,we will get element as xor of (ai to ak+1) element ,But for Even K ,I am having problem
We can break into odd nos. in that form 2^x-1
What I understood that if k is even then we will do 1 operation and now value of k =k-1 which is odd and now we will do same thing what we are doing for odd??
Correct me if I am wrong
Answer this also
Pls refer this for 3rd ques …
And for 2nd ques we can see that if we try to divide the members equally then we can have the optimal arrangement and can always be sure with that arrangement as we are trying to divide the teams to be equal. And a match takes 30 mins. and so if we consider X hours then we can have total 2X matches. And so on we just need to check if 2X >= log2(n) if yes return 1 else 0.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.


