# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1038328 | vjudge1 | Colors (BOI20_colors) | C++17 | 1 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(nullptr);
long long int N;
cin>>N;
long long int inf = 1, sup = N;
queue<long long int> Q;
long long int M = N-1;
int alfa=0;
long long int beta=1;
while(M>0){
Q.push((M+1)/2);
if(alfa%2==1) beta+=(M+1)/2;
M/=2;
alfa++;
}
map<long long int, int> m;
long long int dif=0;
cout<<"? "<<beta<<endl;
m[beta]++;
bool b;
alfa=0;
cout.flush();
cin>>b;
while(!Q.empty()){
dif+=Q.front();
if(alfa%2==0){
beta+=dif;
}else{
beta-=dif;
}
if((beta<0)|(beta>N)|(m[beta]>0)) break;
cout<<"? "<<beta<<endl;
m[beta]++;
cout.flush();
cin>>b;
if(b){
sup=dif;
dif-=Q.front();
}else{
inf=dif+1;
}
Q.pop();
alfa++;
}
cout<<"= "<<inf<<endl;
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... |