# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971695 | 12345678 | Super Dango Maker (JOI22_dango3) | C++17 | 2122 ms | 808 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;
const int nx=1e4+5;
mt19937 rng(time(0));
int used[nx], n, m, p[nx];
vector<pair<int, int>> s;
int query()
{
vector<int> qrs;
for (int i=1; i<=n*m; i++) if (!used[i]) qrs.push_back(i);
return Query(qrs);
}
void Solve(int N, int M) {
n=N, m=M;
vector<pair<int, int>> s;
for (int i=1; i<=N*M; i++) s.push_back({rng(), i});
sort(s.begin(), s.end());
for (int i=1; i<=N*M; i++) p[s[i-1].second]=i;
for (int i=M; i>=2; i--)
{
vector<int> res;
for (int j=1; j<=N*M; j++)
{
if (res.size()==N) break;
if (used[p[j]]) continue;
used[p[j]]=1;
if (query()==i-1) res.push_back(p[j]);
else used[p[j]]=0;
}
Answer(res);
}
vector<int> res;
for (int i=1; i<=N*M; i++) if (!used[p[i]]) res.push_back(p[i]);
Answer(res);
}
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... |