# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1164686 | SmuggingSpun | The Big Prize (IOI17_prize) | C++20 | 1071 ms | 1176 KiB |
#include<bits/stdc++.h>
#include "prize.h"
using namespace std;
int find_best(int n) {
vector<int>f(n, -1);
auto id = [&] (int i){
if(f[i] != -1){
return f[i];
}
vector<int>cnt = ask(i);
return f[i] = cnt[0] + cnt[1];
};
for(int i = 0; i < n; ){
if(id(i) == 0){
return i;
}
if(id(i) != id(i + 1)){
i++;
}
else{
int low = i + 2, high = n - 1, p;
while(low <= high){
int mid = (low + high) >> 1;
if(id(i) != id(mid)){
high = (p = mid) - 1;
}
else{
low = mid + 1;
}
}
i = p;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |