# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
986038 | AlphaMale06 | 커다란 상품 (IOI17_prize) | C++14 | 54 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
//vector<int> ask(int i);
int find_best(int n){
if(n<=5000){
for(int i=0; i<n; i++){
vector<int> ans = ask(i);
if(ans[0]==0 && ans[1]==0)return i;
}
}
int summ = 0;
for(int i=0; i<8; i++){
int ind = rand()%n;
vector<int> ans = ask(ind);
summ=max(summ, ans[0]+ans[1]);
if(ans[0]==0 && ans[1]==0)return ind;
}
int prev=-1;
for(int i=0; i<summ; i++){
int l = prev+1, r = n-1;
int best = n-1;
while(l<=r){
int s = l+r>>1;
vector<int> ans = ask(s);
if(ans[0]+ans[1]==0)return s;
if(ans[0]+ans[1]==summ){
if(ans[0]>i){
best=s-1;
r=s-1;
}
else l=s+1;
}
else{
best = s;
r=s-1;
}
}
vector<int> ans = ask(best);
if(ans[0]+ans[1]==0)return best;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |