# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544547 | benson1029 | Super Dango Maker (JOI22_dango3) | C++17 | 1325 ms | 716 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 <vector>
#include<bits/stdc++.h>
using namespace std;
namespace {
int n, m;
bool used[100005];
vector< vector<int> > ans;
vector<int> tmp;
} // namespace
void solve(vector<int> a) {
int size = a.size() / n;
if(size==1) {
ans.push_back(a);
return;
} else {
vector<int> x, y;
for(int i=0; i<a.size(); i++) used[i] = true;
for(int i=0; i<a.size(); i++) {
tmp.clear();
for(int j=0; j<a.size(); j++) {
if(j!=i && used[j]) tmp.push_back(a[j]);
}
int rv = Query(tmp);
//cout << rv << " ";
if(rv < size/2) {
used[i] = true;
x.push_back(a[i]);
} else {
used[i] = false;
y.push_back(a[i]);
}
}
//cout << "\n";
solve(x);
solve(y);
}
}
void Solve(int N, int M) {
srand(1024);
n = N; m = M;
vector<int> t; t.clear();
for(int i=1; i<=N*M; i++) t.push_back(i);
solve(t);
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... |