| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 407007 | ja_kingy | 커다란 상품 (IOI17_prize) | C++14 | 74 ms | 6060 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include <iostream>
using namespace std;
vector<int> cache[200000];
int ans, cnt, done[200000], n;
vector<int> askc(int x) {
if (!done[x]) {
done[x] = 1;
cache[x] = ask(x);
}
return cache[x];
}
void find(int l, int r, int el, int er) {
if (r < l) return;
if (cnt == el + er) return;
int m = l+r>>1;
int x = m;
vector<int> res;
for (; x <= r; x++) {
res = askc(x);
if (res[0] == 0 && res[1] == 0) ans = x;
if (res[0] + res[1] > cnt) {
cnt = res[0] + res[1];
find(0, n-1, 0, 0);
}
if (res[0] + res[1] == cnt) break;
}
if (l != r) {
find(l, m-1, el, x - m + res[1]);
find(x+1, r, res[0], er);
}
}
int find_best(int _n) {
cnt = 1;
n = _n;
find(0, n-1, 0, 0);
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
