Submission #511204

#TimeUsernameProblemLanguageResultExecution timeMemory
511204rajatshenoiColors (BOI20_colors)C++14
0 / 100
2439 ms200 KiB
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int N; cin >> N; vector<int> vec; // for (int i = 1; i <= N; i++) vec.push_back(i); int left = 1, right = N; int prev; int i = 0; while (true) { int mid = (left + right) / 2; if (left == mid) { cout << "= " << left << endl; break; } int realise; cout << "? " << mid << endl; cin >> realise; prev = mid; if (i == 0) { continue; } else { if (realise == 1) { right = abs(prev - mid); } else if (realise == 0) { left = mid - 1; } } i++; } 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...