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;
namespace {
int n, m, f[100000];
} // namespace
inline vector<int> exclude(vector<int> a, vector<int> b) {
vector<int> res;
for (int x : b) f[x] = 1;
for (int x : a) if (!f[x])
res.push_back(x);
for (int x : b) f[x] = 0;
return res;
}
void solve(vector<int> ids) {
int sz = ids.size() / n, new_sz = sz / 2;
// cout << "DIVIDE " << ids.size() << '\n';
// for (int i : ids) { cout << i << ' '; } cout << '\n';
if (sz == 1)
return Answer(ids);
vector<int> oth;
for (int x : ids) {
oth.push_back(x);
if (Query(exclude(ids, oth)) < new_sz)
oth.pop_back();
}
solve(exclude(ids, oth)), solve(oth);
}
void Solve(int N, int M) {
n = N, m = M;
vector<int> ids(n * m);
iota(ids.begin(), ids.end(), 1);
solve(ids);
}
# | 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... |