# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
413293 | Ruxandra985 | Colors (BOI20_colors) | C++14 | 2 ms | 200 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;
//fscanf (fin,"%lld%lld",&n,&c);
cin >> n;
cout << "? " << 1;
cin >> x;
cout << endl;
now = 1;
st = 1;
dr = n - 1;
dir = 0;
while (st <= dr){
mid = (st + dr)/2;
now += mid;
cout << "? " << now;
cin >> x;
cout << endl;
now = 1;
cout << "? " << 1;
cin >> x;
cout << endl;
if (x)
dr = mid - 1;
else st = mid + 1;
}
cout << "= " << st << endl;
/*
eq = -1;
sol = n;
for (p2 = 62 ; p2 >= 0 ; p2--){
if ((1LL << p2) <= n){
/// vezi daca merge p2, daca merge add la C, altfel nu
if (now + sol - (1LL << p2) <= n){
cout << "? " << now + sol - (1LL << p2);
cin >> x;
cout << endl;
now = now + sol - (1LL << p2);
if (x)
sol -= (1LL << p2);
}
else if (now - sol + (1LL << p2) > 0){
cout << "? " << now - sol + (1LL << p2);
cin >> x;
cout << endl;
now = now - sol + (1LL << p2);
if (x)
sol -= (1LL << p2);
}
else cout << "nu";
}
}
cout << "= " << sol - 1 << 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... |