Getting error in an interactive problem...

Revision en1, by Mega_Alpha_001, 2024-03-30 13:00:36

https://codeforces.net/contest/1797/problem/C In this question I am getting wrong ans in test1 but it is working fine idk why I have tried the same type of problem https://codeforces.net/contest/1934/problem/C and it is working fine.

#define ll long long
#define pb push_back
#define vl vector<long long>
#define mll map<long long, long long>
#define pll pair<long long,long long>
#define mod 1000000007
#define fr(c,a,b) for(ll c=a;c<b;c++)
#include<bits/stdc++.h>
using namespace std;
  
ll query(ll x, ll y){
    cout<<"? "<<x<<" "<<y<<endl;
    ll z;cin>>z;
    return z;
}
 
void solve()
{
    ll n,m,a=0,b=0,c=0,d=0,l=0,s=0;cin>>n>>m;
    ll x = query(1,1);
    if(n<x+1){
        a=n;b=x+2-n;
    }else{
        a=x+1;b=1;
    }
    ll y = query(a,b);
    l = abs(a-y/2);
    s=abs(b+y/2);
    cout<<"! "<<l<<" "<<s<<endl;
    
}
 
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;cin>>t;
    while(t--)
    {
        solve();
    }
}

https://codeforces.net/contest/1797/submission/254078499

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Mega_Alpha_001 2024-03-30 13:10:31 8 Tiny change: 'tried the same type' -> 'tried the exactly same type'
en2 English Mega_Alpha_001 2024-03-30 13:05:23 28 Tiny change: '}\n~~~~~\n[https://c' -> '}\n~~~~~\nThis is the submission link [https://c'
en1 English Mega_Alpha_001 2024-03-30 13:00:36 1297 Initial revision (published)