# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785418 | JooDdae | Super Dango Maker (JOI22_dango3) | C++17 | 731 ms | 588 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;
using ll = long long;
int cnt;
vector<int> type[400];
int query(vector<int> v) {
for(int i=0;i<cnt;i++) for(int j=1;j<type[i].size();j++) v.push_back(type[i][j]);
return Query(v);
}
void Solve(int N, int M) {
vector<int> v(N*M);
iota(v.begin(), v.end(), 1);
random_device rd;
shuffle(v.begin(), v.end(), mt19937(rd()));
for(int i=0;i<N*M;i++) {
int u = v.back(); v.pop_back();
int re = query(v);
if(re == M-1) {
type[cnt++].push_back(u);
continue;
}
for(int j=0;j<cnt;j++) {
v.push_back(type[j][0]);
int re = query(v);
v.pop_back();
if(re == M-1) {
type[j].push_back(u);
break;
}
}
}
type[N-1] = v;
for(int i=0;i<M;i++) {
vector<int> re;
for(int j=0;j<N;j++) {
re.push_back(type[j][i]);
}
Answer(re);
}
}
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... |