| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 519749 | Killer2501 | Colors (BOI20_colors) | C++14 | 22 ms | 23916 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>
#define ll long long
#define ld double
#define ull unsigned long long
#define pb push_back
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fi first
#define se second
using namespace std;
const int N = 1e6+5;
const int M = 1e2+2;
const ll base = 1e4;
const ll mod = 998244353;
const int inf = 1e9;
const double ex = 1e-9;
int k, t;
int a[N][2], b[N], tong, fe[N], dp[N][2];
ll ans, sum[N],  n, m;
pii val[N][2];
vector<ll> vi, adj[N];
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
void add(int id, int x)
{
    for(; id <= n+1; id += id & -id)fe[id] += x;
}
int get(int id)
{
    int res = 0;
    for(; id; id -= id & -id)res += fe[id];
    return res;
}
int lwr(ll x)
{
    return lower_bound(vi.begin(), vi.end(), x) - vi.begin() + 1;
}
void sol(int icase)
{
    cin >> n;
    ll l = 1, r = n-1, mid;
    while(l <= r)
    {
        mid = (l+r)>>1;
        vi.pb(mid);
        l = mid+1;
    }
    m = n;
    reverse(vi.begin(), vi.end());
    for(ll x: vi)
    {
        if(t)m += x;
        else m -= x;
        t ^= 1;
    }
    l = 1, r = n-1;
    cout << "? "<<m << endl;
    cin >> k;
    while(l <= r)
    {
        mid = (l+r)>>1;
        if(t)m += mid;
        else m -= mid;
        cout << "? " << m << endl;
        cin >> k;
        t ^= 1;
        if(k)r = mid-1;
        else l = mid+1;
    }
    cout <<"= "<<l<<endl;
}
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    #define task "tests"
    if(fopen(task".inp", "r"))
	{
		freopen(task".inp", "r", stdin);
		freopen(task".out", "w", stdout);
	}
    int test = 1;
    //cin >> test;
    for(int i = 1; i <= test; i ++)sol(i);
    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... | ||||
