Try L = R = 0 in your code and try even try generating some random cases as well.
because 2 ^42 is > 10^12, which is the upper limit
thanks.
In the tester’s solution, what does it mean when the comment part says “taking all possible prefix of R” ?
No i think its fine.ur Z has 7 digits, in the explaination only 6 digits are there
@harshil21 I am getting wrong answer now.Can you give me some testcases where i am getting wrong.
I had tried all the testcases mentioned here.Don’t know what i am missing
@harshil21 trying to solve subtask 2 getting WA
could you let me know which case I’m missing
tried test cases shared by you on this thread getting the expected output
solution url : CodeChef: Practical coding for everyone
@rajasalok1996 Though several 2^n-1 with bits greater than bits in x and y (in other words, simply greater in value than both x and y) will maximize F, we need to find minimum value of Z that minimizes the given expression.
Just missing the last bits probably
2
318458 58156 0 28842
794296 28206 0 26
You are missing these cases.
@harshil21, first of all, nice editorial!
Can you please mention what range of numbers was used in the testcases due to which even a single testcase didn’t got executed within the time limit, leading to entire TLE and 0.0 score, for Brute-Force Approach.
Thanks!
Hey @harshil21. Can you please review this and tell which test cases its failing?
https://www.codechef.com/viewsolution/33065603
Only for subtask 2.
Thanks! forgot to handle it
Maybe your code would fail on higher case as you’ve not used 1LL or 1ll while shifting.
For. example:
(1 << 41) != (1LL << 41).
Test data is generated randomly between the given constraints.
But I could see into it if you could provide me a link of the solution.
Why can’t you guys put readable codes here in the editorials? With so many defines and functions, the code becomes very messy.
@harshil21 CodeChef: Practical coding for everyone
Please look into my code
I had tried all the testcases memtioned here.All are giving correct aswers.But i am not getting AC.
Please give other test cases where i am failing
Thank you for an active invitation to help me with my code. Basically, I had just tried a brute force approach after optimising the low and high values aptly to some binary numbers of the form 2^n-1, assuming that minimum Z for maximum value of given equation will be within this range.
Though it worked for smaller custom inputs and the sample inputs that were given with the question, it was not even able to get any partial marking from the submission result.
In case you’d like to see the code, here’s the link to my bruteforce approach.
https://www.codechef.com/viewsolution/32482373
Try
1
154112 33236 0 462
The answer should be 0.
You can not loop from L to R as T ranges upto 10^5 and L,R \le 10^{12}.
You have to find a approach which solves the question through binary bits of the number.
Read the editorial.
I’ve tried to put up a very commented solution so it is very comprehensive for a reader.
The functions simplify the process.