# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
642072 | piOOE | 커다란 상품 (IOI17_prize) | C++17 | 96 ms | 2612 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
using ll = long long;
int find_best(int n) {
int i = 0;
int logn = __lg(n) + 2;
map<int, vector<int>> mp;
int Q = 0;
auto my_ask = [&](int i) {
if (mp.count(i)) {
return mp[i];
} else {
++Q;
if (Q > 10000) {
assert(false);
}
mp[i] = ask(i);
return mp[i];
}
};
for (; i < n;) {
auto a = my_ask(i);
if (a[0] == 0 && a[1] == 0) {
return i;
} else {
int j;
if (a[0] + a[1] < 100) j = 10;
else j = 20;
for (; j > -1; --j) {
if (i + (1 << j) < n && my_ask(i + (1 << j)) == a) {
i += 1 << j;
}
}
++i;
}
}
assert(false);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |