# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
797962 | 2023-07-30T08:00:21 Z | Oyster | Minerals (JOI19_minerals) | C++17 | 1 ms | 336 KB |
#include "minerals.h" #include <vector> #include <utility> #include <algorithm> #include <random> std::vector<std::pair<int, int>> ans; std::random_device rd; std::mt19937 gen(rd()); void DC(std::vector<int> &v) { int N = v.size() >> 1; if (N == 1) return ans.push_back({v[0], v[1]}); std::shuffle(v.begin(), v.end(), gen); std::vector<int> vl, vr; while (v.size()) { if (Query(v.back()) <= N >> 1) vl.push_back(v.back()); else { Query(v.back()); vr.push_back(v.back()); } v.pop_back(); if (vl.size() == N || vr.size() == N) break; } for (const int &i : vl) Query(i); if (vl.size() < N) while (v.size()) vl.push_back(v.back()), v.pop_back(); else while (v.size()) vr.push_back(v.back()), v.pop_back(); 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |