# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
864254 | noobcodur | Mađioničar (COI22_madionicar) | C++14 | 1 ms | 344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
printf("? %d\n", l, r);
fflush(stdout);
scanf("%d\n", 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;
}
}
Compilation message (stderr)
# | 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... |