#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <fstream>
#include <iterator>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cctype>
#include <string>
#include <cassert>
#include <set>
#include <bitset>
#include <unordered_set>
#include <numeric>
#define all(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppi pair<int,pair<int,int>>
#define int int64_t
using namespace std;
// /\_/\
// (= ._.)
// / > \>
// encouraging cat
const int INF = 10000000000000000;
//const int mod = 1000000007;
const int mod = 998244353;
const int MAXN = 200005;
//ifstream fin('xor.in');
//ofstream fout('xor.out');
int res = 1;
int queries = 0;
bool query(int l,int r)
{
if (l < 0)
{
return false;
}
if (l == r)
{
return true;
}
queries++;
cout << "? " << l + 1 << " " << r + 1 << '\n';
cout.flush();
int x;
cin >> x;
if (x)
{
res = max(res, r - l + 1);
}
return x;
}
signed main()
{
int n;
cin >> n;
cout << "? " << 0 << " " << 0 << '\n';
cout.flush();
int x;
cin >> x;
// int l = 1,r = 1;
// while (r < n)
// {
// while (query(l - (r - l),r))
// {
// r++;
// if (r == n)
// {
// break;
// }
// }
// l++;
// }
// l = 1, r = 1;
// while (r < n)
// {
// if (r < l)
// {
// r = l;
// }
// if (r == n)
// {
// break;
// }
// while (query(l - (r - l) - 1, r))
// {
// r++;
// if (r == n)
// {
// break;
// }
// }
// l++;
// }
cout << "! " << res << '\n';
//cout << "asked: " << queries << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |