### Judy_Wafai's blog

By Judy_Wafai, history, 7 weeks ago,

Hello codeforces, yesterday I read this problem 1934C - Найдите мину and I thought and today I am trying to solve it, I get the solution but it has a bug please can you help me this is my code:

# include "bits/stdc++.h"

using namespace std; int32_t main() {

//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;
cin >> t;
while (t--)
{
int n , m , d1 , d2 , d3 , d4;
cin >> n >> m; n-- , m--;
cout << "? " << 1 << " " << 1 << "\n";
cin >> d1;
cout << "? " << 1 << " " << m+1 << "\n";
cin >> d2;
cout << "? " << n+1 << " " << m+1 << "\n";
cin >> d3;
int y = (m+d1-d2)/2 , x = d1-y;
cout << "? " << x+1 << " " << y+1 << "\n";
cin >> d4;
if (d4 == 0){
cout << "! " << x+1 << " " << y+1 << "\n";
continue;
}
x = (n+d1-d3)/2 , y = x+m-d2;
cout << "! " << x+1 << " " << y+1 << "\n";
cout << "\n";
}
return 0;

} Thanks very much!

• -2

 » 7 weeks ago, # |   0 Auto comment: topic has been updated by Judy_Wafai (previous revision, new revision, compare).
 » 7 weeks ago, # |   +8 use cout.flush(); after every thing u cout like:cout << "blah blah blah" << '\n'; cout.flush();
•  » » 7 weeks ago, # ^ |   -8 It did not work.