이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "minerals.h"
using namespace std;
bool query(int x) {
static int last = 0;
int cur = Query(x);
bool ans = cur != last;
last = cur;
return ans;
}
void solve(vector<int> l, vector<int> r, bool fill) {
int n = (int) l.size(), m = ceil(n * 0.36);
if (fill) {
m = n - m;
}
if (n == 1) {
Answer(l[0], r[0]);
return;
}
if (fill) {
for (int i = n - 1; i >= m; --i) {
query(l[i]);
}
} else {
for (int i = 0; i < m; ++i) {
query(l[i]);
}
}
vector<int> left, right;
random_shuffle(r.begin(), r.end());
for (auto i : r) {
if ((int) left.size() == m) {
right.push_back(i);
} else if ((int) right.size() == n - m) {
left.push_back(i);
} else if (query(i)) {
right.push_back(i);
} else {
left.push_back(i);
}
}
solve(vector<int>(l.begin(), l.begin() + m), left, true);
solve(vector<int>(l.begin() + m, l.end()), right, false);
}
void Solve(int n) {
vector<int> l, r;
for (int i = 1; i <= n * 2; ++i) {
if (query(i) == 1) {
l.push_back(i);
} else {
r.push_back(i);
}
}
solve(l, r, true);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |