제출 #1137521

#제출 시각아이디문제언어결과실행 시간메모리
1137521ConquerConquererColors (BOI20_colors)C++20
0 / 100
0 ms408 KiB
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<long long> save; long long low = 1, high = n; while (low < high) { long long mid = (low + high) >> 1; save.push_back(mid); low = mid + 1; } long long pos = n; while (save.size() > 0) { long long x = save.back(); if (pos - x < 0) pos += x; else pos -= x; save.pop_back(); } cout << "? " << pos << endl; int trolley; cin >> trolley; low = 1, high = n; while (low < high) { long long mid = (low + high) >> 1; long long L = pos - 1, R = n - pos; if (L < mid) pos += mid; else pos -= mid; cout << "? " << pos << endl; int res; cin >> res; if (res) high = mid; else low = mid + 1; } cout << "= " << low; 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...