Submission #288955

# Submission time Handle Problem Language Result Execution time Memory
288955 2020-09-02T08:28:53 Z AMO5 Xoractive (IZhO19_xoractive) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
//#include "interactive.h"

using namespace std;

#define ii pair<int,int>
#define vi vector<int>
#define sz(x) (int)x.size()

vi pos[111];

vi guess(int n){
	vi res;
	res.resize(n);
	if(n<=15){
		for(int i=0; i<n; i++)
			res[i]=ask(i+1);
		return res;
	}
	res[0]=(ask(1));
	int k=-1;
	while(n>(1<<++k)){}
	for(int i=0; i<k; i++){
		vi po;
		for(int j=0; j<n; j++){
			if(j>>i&1)po.emplace_back(j+1);
		}
		vi q = get_pairwise_xor(po);
		po.emplace_back(1);
		
		pos[i] = get_pairwise_xor(po);
		pos[i].erase(pos[i].begin());
		for(int x:q)
			pos[i].erase(find(pos[i].begin(),pos[i].end(),x));
		for(int &x:pos[i]){
			x=x^res[0];
		}
	}
	for(int i=1; i<n; i++){
		vi v;
		for(int j=0; j<k; j++){
			if((i>>j&1)^1)continue;
			//settle overlapping
			if(sz(v)){
				vi w;
				for(int x:pos[j]){
					if(find(v.begin(),v.end(),x)!=v.end())
						w.emplace_back(x);
				}
				v = w;
			}else{
				v = pos[j];
			}
		}
		for(int j=0; j<k; j++){
			if(i>>j&1)continue;
			for(int x:pos[j]){
				if(find(v.begin(),v.end(),x)!=v.end())
					v.erase(find(v.begin(),v.end(),x));
			}
		}
		res[i]=v[0];
	}
	return res;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:17:11: error: 'ask' was not declared in this scope
   17 |    res[i]=ask(i+1);
      |           ^~~
Xoractive.cpp:20:10: error: 'ask' was not declared in this scope
   20 |  res[0]=(ask(1));
      |          ^~~
Xoractive.cpp:28:10: error: 'get_pairwise_xor' was not declared in this scope
   28 |   vi q = get_pairwise_xor(po);
      |          ^~~~~~~~~~~~~~~~