Submission #864252

# Submission time Handle Problem Language Result Execution time Memory
864252 2023-10-22T09:26:53 Z noobcodur Mađioničar (COI22_madionicar) C++14
0 / 100
511 ms 344 KB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define forn(i,j) for(ll i = 0; i < j; i++)
#define forrange(i,j,k) for(int i = j; i < k; ++i)
#define rof(i,j) rof(int i = j; i >= 0; --i)
#define pii pair<int,int>
#define vll vector<ll>
#define vi vector<int>
#define vvll vector<vll>
#define vvi vector<vi>
#define vb vector<bool>
#define pb push_back
#define p push
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define debug(x) cerr << #x << " is " << x << endl;

#define MOD 1000000007

int t;

void check(int l, int r){
	t = 0;
	cout << flush << "? " << l << " " << r << endl;
	cin >> t;
}

bool check2(int l, int r){
	check(l,r);

	if(t == 1){
		return true;
	}

	return false;
}

int main(){
	int n;
	cin >> n;

	int max = 0;

	forrange(i,1,n+1){
		if(i + max + 1 < n + 1 && i - max - 1 > 0){
			if(check2(i - max - 1,i + max + 1)){
				max++;
			}
		}
	}

	if(max == 0){
		cout << 1 << endl;
	}

	else{
		cout << max << endl;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 344 KB invalid token
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 344 KB invalid token
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 511 ms 344 KB invalid token
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 344 KB invalid token
2 Halted 0 ms 0 KB -