답안 #1096344

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1096344 2024-10-04T10:27:17 Z laure Colors (BOI20_colors) C++14
0 / 100
0 ms 344 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int l=1,r=n;
    int x;
    if(n==2)
    {
        cout<<"? 1"<<endl;
        cin>>x;
        cout<<"? 2"<<endl;
        cin>>x;
        if(x==0)cout<<"= 2"<<endl;
        else cout<<"= 1"<<endl;
        return 0;
    }
    int a,b;
    a=(1+n/2+1)/2;
    cout<<"? "<<a<<endl;
    cin>>x;
    int y=1;
    while(l<r)
    {
        if(y==min(n,64ll))break;
        y++;
        int mid=(l+r)/2;
        //if(a==mid){mid--;l--;}
        if(a+mid<=n)b=a+mid;
        else b=a-mid;
        a=b;
        cout<<"? "<<b<<endl;
        cin>>x;
        if(x==0)
        {
            l=mid+1;
        }
        else
        {
            r=mid;
        }
    }
    if(x==1)cout<<"= "<<l<<endl;
    else cout<<"= "<<r<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Runtime error 0 ms 344 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Runtime error 0 ms 344 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Runtime error 0 ms 344 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Runtime error 0 ms 344 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Runtime error 0 ms 344 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -