Submission #255901

# Submission time Handle Problem Language Result Execution time Memory
255901 2020-08-02T05:12:16 Z 최은수(#5029) Colors (BOI20_colors) C++17
0 / 100
1 ms 384 KB
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18+7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin>>n;
    ll s=1,e=n;
    vector<ll>dv;
    while(s<e)
    {
        ll m=s+(e-s)/2;
        dv.eb(m);
        s=m+1;
    }
    reverse(all(dv));
    ll sign=1;
    ll cur=1;
    for(ll&t:dv)
        cur+=t*sign,sign*=-1;
    cout<<"? "<<cur<<endl;
    int res;
    cin>>res;
    s=1,e=n;
    while(s<e)
    {
        ll m=s+(e-s)/2;
        cur+=m*sign;
        sign*=-1;
        cout<<"? "<<cur<<endl;
        cin>>res;
        if(res==1)
            e=m;
        else
            s=m+1;
    }
    cout<<"= "<<s<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer parameter [name=k] equals to 8, violates the range [1, 7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer parameter [name=k] equals to 8, violates the range [1, 7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer parameter [name=k] equals to 8, violates the range [1, 7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer parameter [name=k] equals to 8, violates the range [1, 7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Integer parameter [name=k] equals to 8, violates the range [1, 7]
2 Halted 0 ms 0 KB -