Submission #387160

# Submission time Handle Problem Language Result Execution time Memory
387160 2021-04-08T05:25:55 Z kevinxiehk Xoractive (IZhO19_xoractive) C++17
0 / 100
2 ms 620 KB
#include "interactive.h"
#include "bits/stdc++.h"
using namespace std;

vector<int> guess(int n) {
	vector<int> ans(n);
	ans[0] = ask(1);
	vector<int> hm[7];
	vector<int> hv[7];
	set<int> tot;
	for(int i = 0; i <= 6; i++) {
		if(n < (1 << i)) break;
		for(int j = 2; j <= n; j++) {
			if(j & (1 << i)) hm[i].push_back(j);
		}
		vector<int> have =  get_pairwise_xor(hm[i]);
		hm[i].push_back(1);
		vector<int> have2 = get_pairwise_xor(hm[i]);
		int add = 1;
		for(int j = 0; j < have.size(); j++) {
			while(have[j] != have2[j + add]){
				hv[i].push_back(have2[j + add] ^ ans[0]);
				tot.insert(have2[j + add] ^ ans[0]);
				add += 2;
			}
		}
		assert(have2.size() == hm[i].size() - 1);
	}
	for(auto x: tot) {
		int id = 0;
		for(int i = 0; i <= 6; i++) {
			if(n < (1 << i)) break;
			for(auto y: hv[i]) {
				if(x == y) {
					id += (1 << i);
				}
			}
		}
		ans[id - 1] = x;
	}
	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:20:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for(int j = 0; j < have.size(); j++) {
      |                  ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 620 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -