# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1031065 | ttamx | Colors (BOI20_colors) | C++17 | 1 ms | 608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll n;
inline int ask(ll x){
cout << "? " << x << endl;
int res;
cin >> res;
return res;
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
ll pos=1,dir=1,st=1,step=0;
int cnt=0;
for(ll i=n;i>1;i=(i+1)/2){
step+=i/2;
pos+=dir*step;
if(pos<1){
ll dif=1-pos;
pos+=dif,st+=dif;
}
dir=-dir;
}
ll ans=1;
ask(st);
dir=1,step=0;
for(ll i=n;i>1;){
st+=dir*(step+i/2);
if(!ask(st)){
ans+=i/2;
step+=i/2;
i=(i+1)/2;
}else{
i=i/2;
}
dir=-dir;
}
cout << "= " << ans << endl;
}
컴파일 시 표준 에러 (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... |