이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")//,bmi,bmi2,lzcnt,popcnt
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using piii = pair<ll, pii>;
#define pb push_back
#define F first
#define S second
#define len(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define file freopen("connect.in", "r", stdin);freopen("connect.out", "w", stdout);
#define kill(x) {cout << x << '\n'; continue;}
#define int long long
const int maxn = 3e3 + 5, maxm = 2e5, LG = 20, MOD = 1e9+7;// 998244353
const ll inf = 6e18;
//priority_queue< int, vector<int>, greater<int>> pq; min heap
//priority_queue< int, vector<int>, less<int> > pq; max heap
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n;
int l = 1, r = n+1;
while(true) {
int mid = (l + r) >> 1;
cout << "? " << mid << endl;
int x;
cin >> x;
if(x == -1) l = mid;
else if(x == 1) r = mid;
else if(x == 0) {cout << "= " << mid << endl; break;}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |