This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
int find_best(int n) {
if(ask(0)[1]==0) return 0;
vector<int> s, as;
int a = 1;
int b = 1;
while(b <= n) {
s.push_back(a);
as.push_back(b);
a = a*a + 1;
b += a;
}
int k = 0;
int p = 0; for(; (1<<(p+1)) <= n; p++);
for(int i = p; ~i; i--) {
int l = k+(1<<i);
if(l < n && ask(l)[1]) k = l;
}
return k+1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |