Submission #959893

# Submission time Handle Problem Language Result Execution time Memory
959893 2024-04-09T09:35:53 Z pcc Mađioničar (COI22_madionicar) C++17
13 / 100
1109 ms 596 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")

#define pii pair<int,int>
#define fs first
#define sc second
#define ll long long

int N;

bool check(int len){
	if(len<=1)return true;
	for(int i = 1;i+len-1<=N;i++){
		cout<<"? "<<i<<' '<<i+len-1<<endl;
		int re;
		cin>>re;
		if(re)return true;
	}
	return false;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N;
	int l = 0,r = N>>1;
	while(l != r){
		int mid = (l+r+1)>>1;
		if(check(mid*2))l = mid;
		else r = mid-1;
	}
	int ans = l*2;
	l = 1,r = (N+1)>>1;
	while(l != r){
		int mid = (l+r+1)>>1;
		if(check(mid*2-1))l = mid;
		else r = mid-1;
	}
	ans = max(ans,r*2-1);
	cout<<"! "<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 588 ms 344 KB Output is correct
2 Correct 777 ms 596 KB Output is correct
3 Correct 782 ms 344 KB Output is correct
4 Correct 521 ms 344 KB Output is correct
5 Correct 753 ms 344 KB Output is correct
6 Correct 517 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 371 ms 344 KB Output is correct
9 Correct 281 ms 344 KB Output is correct
10 Correct 777 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 588 ms 344 KB Output is correct
2 Correct 777 ms 596 KB Output is correct
3 Correct 782 ms 344 KB Output is correct
4 Correct 521 ms 344 KB Output is correct
5 Correct 753 ms 344 KB Output is correct
6 Correct 517 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 371 ms 344 KB Output is correct
9 Correct 281 ms 344 KB Output is correct
10 Correct 777 ms 344 KB Output is correct
11 Runtime error 1109 ms 432 KB Execution killed with signal 13
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1093 ms 428 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 588 ms 344 KB Output is correct
2 Correct 777 ms 596 KB Output is correct
3 Correct 782 ms 344 KB Output is correct
4 Correct 521 ms 344 KB Output is correct
5 Correct 753 ms 344 KB Output is correct
6 Correct 517 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 371 ms 344 KB Output is correct
9 Correct 281 ms 344 KB Output is correct
10 Correct 777 ms 344 KB Output is correct
11 Runtime error 1109 ms 432 KB Execution killed with signal 13
12 Halted 0 ms 0 KB -