Submission #914324

#TimeUsernameProblemLanguageResultExecution timeMemory
9143243as8Colors (BOI20_colors)C++14
9 / 100
1 ms600 KiB
#include <bits/stdc++.h>

#define ll long long
#define fastIO cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);

#define mid ((l + r) / 2)
#define lChild ((index * 2) + 1)
#define rChild ((index * 2) + 2)

using namespace std;

void solve(ll _) {

    ll n; cin>>n;

    if(n == 1) {
        cout<<"= 1"<<endl;
        return;
    }
    cout<<"? "<<1<<endl;
    bool curr; cin>>curr;
    ll ans = n;


    ll last = 1, now = n;
    bool left = true;
    while(true) {

        cout<<"? "<<now<<endl;
        cin>>curr;

        if(curr == 1) ans = abs(now - last);

        ll temp = last;
        last = now;
        now = temp + (left ? 1 : -1);

        if(now == last) break;

        left = !left;

    }

    cout<<"= "<<ans<<endl;
}

int main() {
    fastIO

    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);

    ll t = 0; solve(t);
}
#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...