Submission #1040837

# Submission time Handle Problem Language Result Execution time Memory
1040837 2024-08-01T10:28:38 Z 12345678 Colors (BOI20_colors) C++17
0 / 100
1 ms 436 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

ll n, tmp;

int query(ll x)
{
    cout<<"? "<<x<<endl;
    cin>>tmp;
    return tmp;
}

int main()
{
    cin>>n;
    ll dir=1, st=1, cur=1, l=1, r=n;
    while (l<r)
    {
        ll md=(l+r)/2;
        if (cur+dir*md>=1) cur+=dir*md;
        else st+=1-(cur+dir*md), cur=1;
        l=md+1;
        dir=-dir;
    }
    query(st);
    cur=st, dir=1, l=1, r=n;
    while (l<r)
    {
        ll md=(l+r)/2;
        cur+=dir*md;
        if (query(cur)) r=md;
        else l=md+1;
        dir=-dir;
    }
    cout<<"= "<<l<<endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -