# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
248787 | kostia244 | 커다란 상품 (IOI17_prize) | C++17 | 79 ms | 2028 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
using vi = vector<int>;
int solve(vector<int> p) {
if(p.size() < 100) {
for(auto i : p) {
std::vector<int> res = ask(i);
if(res[0] + res[1] == 0)
return i;
}
}
int cntbad = 0, cg;
vi g;
for(int i = 0; i < 35; i++) {
vi t = ask(p[i]);
cntbad = max(cntbad, (int)p.size() - t[0] - t[1]);
}
cg = p.size() - cntbad;
for(int j = 0, i = 0; i < cg;) {
for(int z = 1<<18; z>>=1;) {
int nj = j+z;
while(nj < p.size()) {
if(count(all(g), p[nj])) {
nj++;
continue;
}
vi t = ask(p[nj]);
if(t[0]+t[1] < cg) g.push_back(p[nj++]);
else break;
}
if(nj >= p.size()) continue;
if(ask(p[nj])[0] < i) j = nj;
}
int nj = j+1;
while(nj < p.size()) {
if(count(all(g), p[nj])) {
nj++;
continue;
}
vi t = ask(p[nj]);
if(t[0]+t[1] < cg) g.push_back(p[nj++]);
else break;
}
i = g.size();
j = nj;
}
return solve(g);
}
int find_best(int n) {
vi t;
for(int i = 0; i < n; i++) t.push_back(i);
return solve(t);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |