# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
797943 | Oyster | Minerals (JOI19_minerals) | C++17 | 14 ms | 2312 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "minerals.h"
#include <vector>
#include <utility>
std::vector<std::pair<int, int>> ans;
void DC(const std::vector<int> &v) {
int N = v.size() >> 1;
if (N == 1) return ans.push_back({v[0], v[1]});
std::vector<int> vl, vr;
for (const int &i : v) {
if (Query(i) <= N >> 1) vl.push_back(i);
else {
Query(i);
vr.push_back(i);
}
}
for (const int &i : vl) Query(i);
DC(vl); DC(vr);
}
void Solve(int N) {
ans.reserve(N);
std::vector<int> v(N << 1);
for (int i = 0; i < v.size(); i++) v[i] = i + 1;
DC(v);
for (const auto &p : ans)
Answer(p.first, p.second);
}
Compilation message (stderr)
# | 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... |