# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
283717 | emanIaicepsa | 커다란 상품 (IOI17_prize) | C++14 | 116 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include<bits/stdc++.h>
#define vi vector<int>
using namespace std;
int find_best(int n) {
if(n <= 5000){
for(int i=0;i<n;i++){
vi tmp = ask(i);
if(tmp[0] + tmp[1] == 0) return i;
}
}
int mx = 0;
for(int i=0;i<5000;i+=10){
vi tmp = ask(i);
mx = max(mx, tmp[0] + tmp[1]);
}
int l = 0;
while(1){
vi tmp = ask(l);
if(tmp[0] == 0 && tmp[1] == 0) return l;
if(tmp[0] + tmp[1] < mx) l++;
else break;
}
while(l < n){
int L = l, R = n-1;
vi cur = ask(l);
while(L < R){
int m = (L+R+1)/2;
vi tmp = ask(m);
if(tmp[0] != cur[0] || tmp[1] != cur[1]) R = m - 1;
else L = m;
}
if(L == n-1) break;
l = L+1;
while(1){
if(l == n) break;
cur = ask(l);
if(cur[0] == 0 && cur[1] == 0) return l;
if(cur[0] + cur[1] < mx) l++;
else break;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |