# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
413656 | Ruxandra985 | Colors (BOI20_colors) | C++14 | 3 ms | 328 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
//FILE *fin = fopen ("a.in" , "r");
long long n , c , now , x , sol = 0 , eq , p2 , st , dr , mid , dir , inc;
//fscanf (fin,"%lld%lld",&n,&c);
cin >> n;
now = n;
dir = -1;
inc = n;
st = 1;
dr = n - 1;
while (st <= dr){
mid = (st + dr) / 2;
now = now + dir * mid;
dir = -dir;
if (now >= n){
inc = inc - (now - n);
now = n;
}
st = mid + 1; /// worst case
}
cout << "? " << inc << endl;
cin >> x;
now = inc;
st = 1;
dr = n - 1;
dir = -1;
while (st <= dr){
mid = (st + dr)/2;
now = now + mid * dir;
dir = -dir;
cout << "? " << now << endl;
cin >> x;
if (x)
dr = mid - 1;
else st = mid + 1;
}
cout << "= " << st << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |