Mega_Alpha_001's blog

By Mega_Alpha_001, history, 7 months ago, In English

https://codeforces.me/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 exactly same type of problem https://codeforces.me/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();
    }
}

This is the submission link https://codeforces.me/contest/1797/submission/254078499

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it