Submission #930495

# Submission time Handle Problem Language Result Execution time Memory
930495 2024-02-20T03:10:11 Z Faisal_Saqib Colors (BOI20_colors) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
void found(int c)
{
    cout<<"= "<<c<<endl;
    exit(0);
}
int query(int x)
{
    cout<<"? "<<x<<endl;
    int p;
    cin>>p;
    return p;
}

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin>>n;
    int s=0;
    int e=n;
    while(s+1<e)
    {
        int mid=(s+e)/2;
        query(1);
        if(query(1+(mid)))
        {
            e=mid;
        }
        else{
            s=mid;
        }
    }
    found(e);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -