이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>vec;
int find_best(int n) {
// -------------- 前処理 -----------------
for(int i=0;i<n;i++) vec.push_back(i);
while(vec.size() >= 2){
int maxn=0;
for(int i=0;i<30;i++){
vector<int>P = ask(vec[rand()%vec.size()]);
maxn = max(maxn, P[0] + P[1]);
}
assert(maxn>(int)vec.size());
vector<int>vec2; int ret = -1;
for(int h=0;h<maxn;h++){
int cx = 0;
for(int i=17;i>=0;i--){
int pos = cx + (1 << i) - 1; if(pos >= (int)vec.size()) pos = vec.size() - 1;
vector<int>L = ask(vec[pos]);
if((L[0] + L[1] == maxn && L[0] == h) || pos <= ret) cx += (1 << i);
}
vec2.push_back(vec[cx]); ret = cx;
}
vec = vec2;
}
return vec[0];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |