Submission #1114507

# Submission time Handle Problem Language Result Execution time Memory
1114507 2024-11-19T06:43:06 Z NotLinux Mađioničar (COI22_madionicar) C++17
0 / 100
3059 ms 336 KB
// Author : FatihCihan
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
int ask(int l , int r){
	cout << "? " << l << " " << r << endl;
	int x;
	cin >> x;
	return x;
}
void answer(int x){
	cout << "! " << x << endl;
	exit(0);
}
void solve(){
	int n;
	cin >> n;
	int r = 1 , ans = 1;
	for(int i = 1;i<=n;i++){
		r = max(r , i);
		while((r < n) and (i - (r - i)) > 1 and ask(i-(r-i)-1 , r+1)){
			r++;
		}
		ans = max(ans , 2 * (r - i) + 1);
	}
	answer(ans);
}
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int testcase = 1;//cin >> testcase;
	while(testcase--)solve();
	cerr << 1000.0 * clock() / CLOCKS_PER_SEC << " ms" << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 246 ms 336 KB L = 25, expected 30
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 246 ms 336 KB L = 25, expected 30
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3059 ms 336 KB L = 33, expected 52
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 246 ms 336 KB L = 25, expected 30
2 Halted 0 ms 0 KB -