# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
914233 | edogawa_something | Colors (BOI20_colors) | C++17 | 0 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define pb push_back
#define all(v) v.begin(),v.end()
#define pow poww
const ll M=1e5+10;
const ll inf=2e18;
const ll mod=1e9+7;
ll pow(ll x,ll y){
ll res=1;
x%=mod;
while(y>0){
if((y&1))
res*=x,res%=mod;
x*=x,x%=mod;
y=(y>>1);
}
return res;
}
ll n,ans,cn;
bool ask(ll x){
cout<<"? "<<x<<endl;
bool c;
cin>>c;
return c;
}
void ret(ll x){
cout<<"= "<<x<<endl;
}
int main(){
ios_base::sync_with_stdio(0),cin.tie(0);
ll TC=1;
//cin>>TC;
while(TC--){
cin>>n;
ll x=n/4+1;
ask(x);
ll l=1,r=n-1,mid;
for(int i=0;i<64;i++){
if((1<<i)>n){
cn=i;
break;
}
}
bool c=0;
ll cur=0;
while(l<=r){
cn--;
if(cn==-1)
break;
if(c){
if(x-cur-(1<<cn)<1)
continue;
if(ask(x-cur-(1<<cn)))
cur+=(1<<cn);
x-=cur;
}
else{
if(x+cur+(1<<cn)>n)
continue;
if(ask(x+cur+(1<<cn)))
cur+=(1<<cn);
x+=cur;
}
c^=1;
}
ret(cur);
}
return 0;
}
/*
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |