제출 #1129961

#제출 시각아이디문제언어결과실행 시간메모리
1129961vladiliusColors (BOI20_colors)C++20
0 / 100
0 ms432 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; auto ask = [&](int x){ cout<<"? "<<x<<"\n"; cout.flush(); bool t; cin>>t; return t; }; auto check = [&](int x){ if (x == n){ ask(1); return !ask(n); } ask(1); return ask(x + 1); }; int l = 1, r = n; while (l + 1 < r){ int m = (l + r) / 2; if (check(m)){ r = m; } else { l = m + 1; } } if (check(l)) r = l; cout<<"= "<<r<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...