# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1075911 | mdn2002 | 커다란 상품 (IOI17_prize) | C++14 | 45 ms | 1296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
map<int, vector<int>> mp;
vector<int> askk (int x) {
if (mp.count(x) == 0) return mp[x] = ask(x);
return mp[x];
}
int find_best(int n) {
int mx = 0, lim = 500;
for (int i = 0; i < min(n, lim); i ++) {
vector<int> a = askk(i);
mx = max(mx, a[0] + a[1]);
if (a[0] + a[1] == 0) return i;
}
for (int i = 0; i < n; i ++) {
vector<int> a = askk(i);
if (a[0] + a[1] == mx) {
if (i + 220 < n) {
vector<int> c = askk(i + 220);
if (a[1] == c[1]) {
i += 220;
continue;
}
}
int l = 0, r = 220;
while (l < r) {
int mid = (l + r) / 2;
if (i + mid >= n) r = mid;
else {
vector<int> b = askk(i + mid);
if (a[1] == b[1]) l = mid + 1;
else r = mid;
}
}
i += l - 1;
}
else if (a[0] + a[1] == 0) return i;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |