Submission #334416

# Submission time Handle Problem Language Result Execution time Memory
334416 2020-12-09T06:18:56 Z nikatamliani Xoractive (IZhO19_xoractive) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "interactive.h"
#include "grader.cpp"
using namespace std;

vector<int> guess(int n) {
	vector <int> ans;
	int x = ask(1);
	ans.push_back(x);
	set<int> all, s[7];
	for(int bit = 0; bit < 7; ++bit) {
		vector<int> to_ask;
		for(int i = 2; i <= n; ++i) {
			if(i >> bit & 1) {
				to_ask.push_back(i);
			}
		}
		vector<int> xors_without_1 = get_pairwise_xor(to_ask);
		to_ask.push_back(1);
		vector<int> xors_with_1 = get_pairwise_xor(to_ask);
		map<int,int> freq;
		for(int i : xors_without_1) freq[i]++;
		for(int x : xors_with_1) {
			if(freq[x] == 0) {
				s[bit].insert(x);
				all.insert(x);
			} else {
				--freq[x];
			}
		}
	}
	for(int i = 2; i <= n; ++i) {
		for(int val : all) {
			if(!val) continue;
			bool ok = true; 
			for(int bit = 0; bit < 7; ++bit) {
				if(i >> bit & 1) {
					if(s[bit].find(val) == s[bit].end()) {
						ok = false;
					}
				}
			}
			if(ok) {
				ans.push_back(val);
				break;
			}
		}
	}
	return ans;
}

Compilation message

/tmp/ccpux1WI.o: In function `query()':
grader.cpp:(.text+0x30): multiple definition of `query()'
/tmp/ccEPmUXQ.o:Xoractive.cpp:(.text+0x30): first defined here
/tmp/ccpux1WI.o: In function `ask(int)':
grader.cpp:(.text+0x60): multiple definition of `ask(int)'
/tmp/ccEPmUXQ.o:Xoractive.cpp:(.text+0x60): first defined here
/tmp/ccpux1WI.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccEPmUXQ.o:Xoractive.cpp:(.text.startup+0x0): first defined here
/tmp/ccpux1WI.o: In function `get_pairwise_xor(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0xc0): multiple definition of `get_pairwise_xor(std::vector<int, std::allocator<int> >)'
/tmp/ccEPmUXQ.o:Xoractive.cpp:(.text+0xc0): first defined here
collect2: error: ld returned 1 exit status