Submission #618852

# Submission time Handle Problem Language Result Execution time Memory
618852 2022-08-02T07:57:14 Z MetalPower Xoractive (IZhO19_xoractive) C++14
0 / 100
2 ms 336 KB
#include <bits/stdc++.h>
using namespace std;

#include "interactive.h"

// ask(i) := returns value at i
// get_pairwise_xor(vec) := returns a set of pairwise xor's

map<int, int> loc;

vector<int> guess(int n){

	int lst = ask(n);

	for(int bt = 0; bt < 7; bt++){

		vector<int> vec;
		for(int i = 1; i <= n - 1; i++)
			if(i & (1 << bt)) vec.push_back(i);
		
		vector<int> st, fn;

		{
			if(vec.empty()) st = {};
			else st = get_pairwise_xor(vec);
		}

		{
			vec.push_back(n);
			fn = get_pairwise_xor(vec);
		}

		vector<int> vals;

		int a = 0, b = 0;
		for(; a < (int) st.size(); a++, b++)
			while(b < (int) fn.size() && fn[b] != st[a]) vals.push_back(fn[b++]);
		while(b < (int) fn.size()) vals.push_back(fn[b++]);
	}

	vector<int> ans;
	ans.resize(n, 0);

	for(auto x : loc) ans[x.second - 1] = x.first;
	ans[n - 1] = lst;
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Output is not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output is not correct
2 Halted 0 ms 0 KB -