Submission #714469

#TimeUsernameProblemLanguageResultExecution timeMemory
714469hollwo_pelwSuper Dango Maker (JOI22_dango3)C++17
100 / 100
1564 ms1016 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...