Submission #853943

#TimeUsernameProblemLanguageResultExecution timeMemory
853943Trisanu_DasXoractive (IZhO19_xoractive)C++17
100 / 100
4 ms596 KiB
#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
#define ff first
#define ss second
 
vector<int> guess(int n) {
	vector<int> a(n);
	a[0] = ask(1);
	map<int,int> ans;
	for(int i = 0; (1 << i) <= n; i++) {
		vector<int> p;
		for(int j = 2; j <= n; j++) if(j & (1 << i)) p.push_back(j);
		auto g1 = get_pairwise_xor(p);
		p.push_back(1);
		auto g2 = get_pairwise_xor(p);
		map<int,int> mp;
		for(auto x: g2) mp[x]++;
		for(auto x: g1) mp[x]--;
		for(auto x: mp) if(x.ss) ans[x.ff ^ a[0]] |= (1 << i);
	}
	for(auto x: ans) a[x.ss - 1] = x.ff;
	return a;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...