# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
951688 | GrandTiger1729 | Super Dango Maker (JOI22_dango3) | C++17 | 173 ms | 856 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>
using namespace std;
void Solve(int n, int m)
{
vector<int> idx(n * m);
iota(idx.begin(), idx.end(), 1);
vector<vector<int>> ans;
while (idx.size())
{
shuffle(idx.begin(), idx.end(), mt19937(time(0)));
int rr = -1;
{
int l = 0, r = idx.size();
while (l < r - 1)
{
int mid = (l + r) / 2;
vector<int> qry;
for (int i = 0; i < mid; i++)
{
qry.push_back(idx[i]);
}
int res = Query(qry);
(res == 0 ? l : r) = mid;
}
rr = l;
}
vector<int> cur, idx2;
cur.push_back(idx[rr]);
for (int i = rr - 1; i >= 0; i--)
{
vector<int> qry = cur;
for (int j = 0; j < i; j++)
{
qry.push_back(idx[j]);
}
int res = Query(qry);
(res == 0 ? cur : idx2).push_back(idx[i]);
}
ans.push_back(cur);
for (int i = rr + 1; i < idx.size(); i++)
{
idx2.push_back(idx[i]);
}
swap(idx, idx2);
}
for (int i = 0; i < m; i++)
{
Answer(ans[i]);
}
}
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... |