제출 #299559

#제출 시각아이디문제언어결과실행 시간메모리
299559E869120Colors (BOI20_colors)C++14
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; int Debug = 1; long long N; long long C = 10; long long prevs = 0; int getans(long long pos) { cout << "? " << pos << endl; if (Debug == 1) { int x; cin >> x; return x; } if (Debug == 2) { int x = -1; if (abs(prevs - pos) < C) x = 0; else x = 1; prevs = pos; return x; } return -1; } int main() { // Step #1. Input cin >> N; // Step #2. Get Answer int cl = 1, cr = N, cm, minx = N; for (int i = 0; i < 32; i++) { cm = (cl + cr) / 2; getans(1); int z = getans(1 + cm); if (z == 1) { minx = min(minx, cm); cr = cm; } else { cl = cm; } } cout << "= " << minx << 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...