이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
int find_best(int N){
int step = sqrt(N);
auto t = ask(0);
int s = t[0] + t[1];
int ans = 0;
while(s){
for(int i = (N - 1) % step; i < N; i += step){
int l = max(0, i - step);
auto k = ask(i);
if(k[0]){
for(int j = l; j <= i; j ++){
k = ask(j);
if(k[0] + k[1] < s){
s = k[0] + k[1];
ans = j;
i = 1e9;
break;
}
}
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |