이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
const int mxN = 200005;
int ans = -1;
// vector<int> ask(int i) {
// int a, b;
// cout << i << "\n";
// scanf("%d %d", &a, &b);
// return {a, b};
// }
void search(int st, int en) {
if(ans > -1) return;
if(st > en) return;
int md = (st+en)/2;
vector<int> p = ask(md);
if(p[0] == 0 && p[1] == 0) {
ans = md;
return;
} else if(p[1] == 0)
search(st, md-1);
else if(p[0] == 0)
search(md+1, en);
else {
search(st, md-1);
search(md+1, en);
}
}
int find_best(int n) {
search(0, n-1);
return ans;
}
// int main() {
// int n;
// scanf("%d", &n);
// printf("%d\n", find_best(n));
// return 0;
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |