Can anyone explain 1st solution ?@harshil21
Somewhat, the solution used modified binary search with initial L = 0 and R = 111\dotsc (39 1's), and then it starts searching for the optimal solution. The overall complexity of this approach is O(log(R - L)).
I could not explain to you the detailed solution because even I didn’t have a clue about it.
I think your code has infinite loop when L and R are same. (Line 28 in your code).
In Subtask3, where M=k if we set z[k]=0 and rest bits as x|y then z<=L also. Then what is the need of brute-forcing all the possible longest common prefixes of z and L
Can you suggest a case for which my code fails in subtask 2 alone ?
CodeChef: Practical coding for everyone my submission link
Iam getting all this testcase correct but still subtask 2 failed for me
CodeChef: Practical coding for everyone solution link
Y code passed this case too , still am getting a WA for one of the case in subtask 2
CodeChef: Practical coding for everyone here is my solution , please help .
HOW TO HANDLE THIS IN JAVA .!!! if DOUBLE used am not able to perform the BINARY OPERATORS
Can you clarify the need of using double in Java to solve it?
@harshil21 code link : CodeChef: Practical coding for everyone
checked all the cases mentioned in the thread working fine for all
Please share the missing case
Just work on these, you’re very close.
3
19377283 19368100 30890 31436
23962289 7250321 22993 23560
11014 21047686 21058127 21061591
Answers:
30895
23473
21060486
When i brute force all the bits , the value of product is exceeding 2^64 thus resulting in a long overflow, that’s y am able to pass subtask 1 and 2 but getting WA and TLE for subtask 3 alone . @harshil21
Here is my solution link
https://www.codechef.com/viewsolution/33177144
2
2369383 11351335 17317 26860
20186496 20195266 20218112 20226640
Now, try generating some random cases on your own and check with the brute force solution to check for answers.
No, your code is missing some other cases, the error is not of overflow.
Try generating random cases and compare with brute force solution.
Yes @harshil21, i found that mistake and rectified ,now all the testcases mentioned in the above comments are getting passed still am getting a WA and TLE in subtask 3
Here is my solution link ,
CodeChef: Practical coding for everyone @harshil21
Even these cases are passed …