#include <bits/stdc++.h>
using namespace std;
#define int long long
#define nl endl
#define hehe ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
const int mod = 1e9+7;
const int M = 2e5+5;
void solve(){
int n; cin >> n;
int ans = 0;
for(int i = 1; i <= n; i++){
for(int j = i; j <= n; j++){
cout << "? " << i << ' ' << j << nl;
cout.flush();
int x; cin >> x;
if(x == 1) ans = max(ans, j - i + 1);
}
}
cout << "! " << ans << nl;
cout.flush();
}
signed main(){
hehe
int t = 1;
while(t--){
solve();
}
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... |