This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
_ _ __ _ _ _ _ _ _
|a ||t ||o d | |o |
| __ _| | _ | __| _ |
| __ |/_ | __ /__\ / _\|
**/
#include <bits/stdc++.h>
#include "dango3.h"
using namespace std;
typedef long long ll;
int Query (const vector <int> &x);
void Answer (const vector <int> &a);
int N, M;
void solve (vector <int> v) {
int k = (int) v.size();
int m = (int) v.size() / N;
if (m == 1) {
for (int &i : v) {
i++;
}
Answer(v);
return;
}
m /= 2;
bool in[k]; fill(in, in + k, true);
for (int i : v) {
in[i] = false;
vector <int> x;
for (int j : v) {
if (in[j] == true) {
x.push_back(j + 1);
}
}
if (Query(x) < m) {
in[i] = true;
}
}
vector <int> split[2];
for (int i : v) {
split[in[i]].push_back(i);
}
solve(split[0]);
solve(split[1]);
}
void Solve (int _N, int _M) {
N = _N; M = _M;
vector <int> v(N * M);
iota(v.begin(), v.end(), 0);
solve(v);
}
# | 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... |