이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dango3.h"
#include <vector>
void Solve(int N, int M) {
auto dfs = [&](auto&& self, std::vector<int> v) -> void {
const int size = (int)v.size() / N;
if (size == 1) {
Answer(v);
} else {
const int half = size / 2;
std::vector<int> v2;
for (int i = 0; i < (int)v.size();) {
const int x = v[i];
std::swap(v[i], v.back());
v.pop_back();
if (Query(v) < half) {
v.push_back(x);
std::swap(v[i], v.back());
i += 1;
} else {
v2.push_back(x);
}
}
self(self, v);
self(self, v2);
}
};
std::vector<int> v(N * M);
for (int i = 1; i <= N * M; ++i) {
v[i - 1] = i;
}
dfs(dfs, v);
}
| # | 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... |