| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 951489 | phoenix0423 | Colors (BOI20_colors) | C++17 | 1 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
int t, pre;
bool qry(int x){
cout<<"? "<<x<<"\n";
cin>>x;
return x;
}
signed main(void){
int n;
cin>>n>>t;
vector<int> step;
int l = 0, r = n;
while(l + 1 < r){
int m = (l + r) / 2;
step.pb(m);
l = m;
}
reverse(step.begin(), step.end());
int pos = 1;
for(int i = 0; i < step.size(); i++){
pos += step[i] * (i % 2 ? -1 : 1);
}
qry(pos);
l = 0, r = n;
int sign = (step.size() % 2 ? -1 : 1);
while(l + 1 < r){
int m = (l + r) / 2;
if(qry(pos + sign * m)) r = m;
else l = m;
pos += sign * m;
sign *= -1;
}
cout<<"= "<<r<<"\n";
}
컴파일 시 표준 에러 (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... | ||||
