# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
868184 | n1k | The Big Prize (IOI17_prize) | C++17 | 4 ms | 436 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
const int LOG = 18, TAKE = 450;
int find_best(int n) {
int mn = 1e9, id, cnt = 0;
for(int id = 0; id < min(TAKE, n); id++){
auto c = ask(id);
int s = c[0] + c[1];
if(s == 0){
return id;
}
mn = min(mn, s);
}
while(id < n){
// find next smallest num
for(; true; id++){
auto c = ask(id);
int s = c[0] + c[1];
cnt = c[0];
if(s == 0){
return id;
}
if(s == mn){
break;
}
}
// overjump all min
for(int j = LOG; j >= 0; j--){
int jump = 1<<j;
if(id + jump > n){
continue;
}
auto c = ask(id + jump);
int s = c[0] + c[1];
if(s == 0){
return id + jump;
}
if(s == mn && c[0] == cnt){
id += jump;
}
}
// go to the next which is not min
id++;
}
assert(false);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |