# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
705073 | Abrar_Al_Samit | 커다란 상품 (IOI17_prize) | C++17 | 75 ms | 420 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "prize.h"
using namespace std;
int find_best(int n) {
int sq = sqrt(n) + 10;
int mx = -1, id;
vector<int>prv;
for(int i=0; i<min(sq, n); ++i) {
auto v = ask(i);
if(v[0]+v[1]>mx) {
mx = v[0] + v[1];
id = i;
prv = v;
}
}
vector<int>good;
for(int i=0; i<id; ++i) {
good.push_back(i);
}
while(id<n-1) {
int to = min(n-1, id+sq);
auto cr = ask(to);
if(cr[0]==prv[0] && cr[1]==prv[1]) {
id = to;
continue;
}
int l = 0, r = to-id;
while(l<r) {
int mid = (l+r+1)/2;
cr = ask(id+mid);
if(cr[0]==prv[0] && cr[1]==prv[1]) {
l = mid;
} else {
r = mid-1;
}
}
id += l+1;
while(id<n) {
cr = ask(id);
if(cr[0]+cr[1]==mx) {
prv = cr;
break;
}
good.push_back(id);
++id;
}
}
for(int x : good) {
auto y = ask(x);
if(y[0]+y[1]==0) {
return x;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |