# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
894622 | boris_mihov | Super Dango Maker (JOI22_dango3) | C++17 | 349 ms | 1208 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 "dango3.h"
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
int n, m;
void rec(std::vector <int> elements, int count)
{
if (count == 1)
{
assert(elements.size() == n);
Answer(elements);
return;
}
std::vector <int> left = elements, right;
for (int i = left.size() - 1 ; i >= 0 ; --i)
{
right.push_back(left[i]);
left.erase(left.begin() + i);
int res = Query(left);
if (res < count / 2)
{
left.push_back(right.back());
right.pop_back();
}
}
rec(left, count / 2);
rec(right, count / 2 + count % 2);
}
void Solve(int N, int M)
{
n = N; m = M;
std::vector <int> elements;
for (int i = 1 ; i <= n * m ; ++i)
{
elements.push_back(i);
}
rec(elements, m);
}
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... |