| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 258726 | sckmd | Colors (BOI20_colors) | C++14 | 0 ms | 256 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;
typedef long long ll;
map <ll,bool> bio;
int main()
{
int n;
cin >> n;
int mx = 62;
ll ans = 0LL;
cout << "? 1\n";
bio[1]=true;
ll lastask = 1;
for(int i = mx; i >= 0; i--)
{
ll now = ans + (1LL<<i);
if(lastask-now > 1 && !bio[lastask-now])
{
cout << "? " << lastask-now << "\n";
int rez;
cin >> rez;
if(rez==1)
{
bio[lastask-now]=true;
lastask -= now;
continue;
}
else
{
bio[lastask-now]=true;
ans += (1LL<<i);
lastask -= now;
continue;
}
}
if(lastask+now <= n && !bio[lastask+now])
{
cout << "? " << lastask+now << "\n";
int rez;
cin >> rez;
lastask += now;
bio[lastask]=true;
if(rez==0)
{
ans += (1LL<<i);
}
}
}
cout << ans;
return 0;
}| # | 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... | ||||
