# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
951713 | qwe1rt1yuiop1 | Super Dango Maker (JOI22_dango3) | C++17 | 154 ms | 852 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 <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;
namespace
{
int variable_example = 1;
} // namespace
mt19937 rng(48763);
void Solve(int n, int m)
{
vector<int> flag(n * m, 1);
for (int ii = 0; ii < m; ++ii)
{
vector<int> todo;
for (int i = 1; i <= n * m; ++i)
if (flag[i - 1])
todo.emplace_back(i);
shuffle(all(todo), rng);
int l = n, r = sz(todo);
while (l < r)
{
int mid = (l + r) >> 1;
vector<int> v;
for (int i = 0; i < mid; ++i)
v.emplace_back(todo[i]);
if (Query(v))
r = mid;
else
l = mid + 1;
}
vector<int> ans;
for (int i = 0; i < l; ++i)
{
auto ans0 = ans;
for (int j = i + 1; j < l; ++j)
ans.emplace_back(todo[j]);
if (Query(ans) == 0)
ans0.emplace_back(todo[i]);
ans = ans0;
}
Answer(ans);
for (int i : ans)
flag[i - 1] = 0;
}
}
/*
3 2
3 3 1 2 1 2
*/
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... |