the first interactive problem in my life

Revision en3, by Judy_Wafai, 2024-03-03 21:19:05

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!

Tags interactive, need help, bug

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Judy_Wafai 2024-03-03 21:19:05 102
en2 English Judy_Wafai 2024-03-03 21:12:11 2 Tiny change: 'ain()\n{\n //io' -> 'ain()\n{\n\n //io'
en1 English Judy_Wafai 2024-03-03 21:10:28 1177 Initial revision (published)