Submission #173717

#TimeUsernameProblemLanguageResultExecution timeMemory
173717Just_Solve_The_ProblemXoractive (IZhO19_xoractive)C++11
100 / 100
7 ms504 KiB
#include <bits/stdc++.h>
#include "interactive.h"
// #include "grader.cpp"

#define ok puts("ok");

using namespace std;

vector <int> ans;

vector<int> guess(int n) {
	map <int, int> ind;
	ans.resize(n, ask(1));
	for (int i = 0; i < 7; i++) {
		vector <int> vec;
		for (int j = 2; j <= n; j++) {
			if ((j >> i) & 1) {
				vec.push_back(j);
			}
		}
		if (vec.empty()) continue;
		vector <int> vv = vec;
		vv.push_back(1);
		vv = get_pairwise_xor(vv);
		vec = get_pairwise_xor(vec);
		map <int, int> cnt;
		for (int to : vv) {
			if (to != 0)
				cnt[to]++;
		}
		for (int to : vec) {
			if (to != 0)
				cnt[to]--;
		}
		// cout << i << "# \n";
		for (int to : vv) {
			if (cnt[to] == 0) continue;
			// cout << (to.first ^ ans[0]) << ' ' << to.second << endl;
			ind[to ^ ans[0]] |= (1 << i);
		}
	}
	for (auto to : ind) {
		// cout << to.first << ' ' << to.second << endl;
		ans[to.second - 1] = to.first;
	}
	return ans;
}
/*
10
1 2 3 4 5 1 2 3 4 5
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...