# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
357654 |
2021-01-24T11:19:47 Z |
leinad2 |
Colors (BOI20_colors) |
C++17 |
|
1 ms |
364 KB |
#include<bits/stdc++.h>
using namespace std;
long long n, a, b, m, prv, ans;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
prv=1;
cout<<"? "<<prv<<endl;
cin>>ans;
a=1;b=n;
while(a<b)
{
m=(a+b)/2;
if(prv-m<1&&prv+m>n)
{
cout<<"? 1"<<endl;
cin>>ans;
prv=1;
}
if(prv-m>=1)
{
prv-=m;
cout<<"? "<<prv<<endl;
cin>>ans;
if(ans==1)b=m;
else a=m+1;
}
else
{
prv+=m;
cout<<"? "<<prv<<endl;
cin>>ans;
if(ans==1)b=m;
else a=m+1;
}
}
cout<<a<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |