Submission #336586

# Submission time Handle Problem Language Result Execution time Memory
336586 2020-12-15T21:05:40 Z mosiashvililuka Xoractive (IZhO19_xoractive) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "interactive.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,f[109];
map <int, int> m;
map <int, int>::iterator tt;
vector <int> v,vv,ans[109];
multiset <int> s,ss;
multiset <int>::iterator it;
set <int> ka;
set <int>::iterator t;
void mul(vector <int> q){
	for(int h=0; h<q.size(); h++){
		if(q[h]==0) continue;
		s.insert(q[h]);
	}
}
vector <int> guess(int n){
	a=n;
	vector <int> pas;
	/*for(int i=1; i<=n; i++){
		v.push_back(ask(i));
	}*/
	f[0]=ask(1);
	for(i=0; ; i++){
		if((1<<i)>=n) break;
		v.clear();
		for(j=1; j<n; j++){
			if(((1<<i)&j)!=0){
				v.push_back(j+1);
			}
		}
		s.clear();
		mul(get_pairwase_xor(v));
		ss=s;s.clear();
		v.push_back(1);
		mul(get_pairwase_xor(v));
		for(it=ss.begin(); it!=ss.end(); it++){
			s.erase(s.lower_bound((*it)));
		}
		ka.clear();
		for(it=s.begin(); it!=s.end(); it++) ka.insert((*it));
		for(t=ka.begin(); t!=ka.end(); t++){
			ans[i].push_back((*t));
		}
	}
	pas.push_back(f[0]);
	for(i=1; i<n; i++){
		zx=0;
		m.clear();
		for(j=0; j<10; j++){
			if(((1<<j)&i)==0) continue;
			zx++;
			for(jj=0; jj<ans[j].size(); jj++){
				m[ans[j][jj]]++;
			}
		}
		for(tt=m.begin(); tt!=m.end(); tt++){
			if((*tt).second==zx){
				pas.push_back(((*tt).first)^f[1]);
				break;
			}
		}
	}
	return pas;
}

Compilation message

Xoractive.cpp: In function 'void mul(std::vector<int>)':
Xoractive.cpp:13:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  for(int h=0; h<q.size(); h++){
      |               ~^~~~~~~~~
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:34:7: error: 'get_pairwase_xor' was not declared in this scope; did you mean 'get_pairwise_xor'?
   34 |   mul(get_pairwase_xor(v));
      |       ^~~~~~~~~~~~~~~~
      |       get_pairwise_xor
Xoractive.cpp:54:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |    for(jj=0; jj<ans[j].size(); jj++){
      |              ~~^~~~~~~~~~~~~~