need help to debug my code for QHOUSE february lunctime…
solution for subtask submitted successfully here is the link
but this submission for 100 is not going in that way…
I need help to debug this code…
Any help will be greatly appreciated…
need help to debug my code for QHOUSE february lunctime…
solution for subtask submitted successfully here is the link
but this submission for 100 is not going in that way…
I need help to debug this code…
Any help will be greatly appreciated…
The mistake is where you write
start=rect.x
for 2^{nd} binary search (line 74).
It should be start=rect.x/2
because you have already multiplied rect.x by 2 and binary search should start from
x coordinate=side_of_square/2.
Can someone please say where I am going wrong ? https://www.codechef.com/viewsolution/12935237 I am not finding any probable errors
The problem is where you return mid at the each binary search function.
It should instead be:
cout << "? " << 0 <<" "<< high << "\n";
fflush(stdout);
cin >> s;
if(s[0] == 'Y')
{return high;}
cout << "? " << 0 <<" "<< low << "\n";
fflush(stdout);
cin >> s;
if(s[0] == 'Y')
{return low;}
return mid;
because it is not necessary that mid has the correct answer.
Similarly for each binary search function.
Here is the corrected solution.
Also, why have you made array a when a[i]=i ?
There was one more error in line 37 of the link which you have given.
It was written a[mid+1]
instead of a[mid]
.
It took a lot of time to find this one.
sorry for posting my question through the answer…but i m a beginner and donot hav enough karma for posting the questions…someone please check my code and please point my error…please…it would be of great help…
https://ideone.com/JRhNnq
You should give codechef submission link.
I suggest you should read the editorial and see setter’s solution.
Thank You so much… just missed that thing… It was difficult to make valid testcase for this question…
Thanks a lot…
Thanks a lot , for helping me out spending your important time. I’m grateful to you friend.
https://www.codechef.com/viewsolution/12936774
There is no link for the editorial on the problem’s page…please help with my code…