제출 #1184010

#제출 시각아이디문제언어결과실행 시간메모리
1184010kl0989eColors (BOI20_colors)C++17
0 / 100
0 ms436 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define ll long long #define fi first #define se second #define pb push_back #define vi vector<int> #define vl vector<ll> #define pi pair<int, int> #define pl pair<ll,ll> #define all(x) (x).begin(),(x).end() bool query(int pos) { cout << "! " << pos << endl; int ret; cin >> ret; return ret; } int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int pos=1; int mul=1; int l=1,r=n-1; while (l<=r) { int m=l+(r-l)/2; pos+=m*mul; mul=-mul; l=m+1; } query(pos); l=1,r=n-1; int ans=n; while (l<=r) { int m=l+(r-l)/2; pos+=m*mul; mul=-mul; if (query(pos)) { ans=m; r=m-1; } else { l=m+1; } } cout << "= " << ans << endl; return 0; }
#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...