Submission #501696

# Submission time Handle Problem Language Result Execution time Memory
501696 2022-01-04T10:38:28 Z BY_KUTBILIM Xoractive (IZhO19_xoractive) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
multiset<int> ss, st;
set<int> ka;
int f[109];
void mul(vector<int> q){
	for(int h = 0; h < q.size(); h++){
		if(q[h] == 0) continue;
		st.insert(q[h]);
	}
}
vector<int> ans[109];
vector<int> guess(int n){
	vector<int> pas;
	f[0] = ask(1);
	for(int i = 0;; i++){
		if((1 << i) >= n)break;
		vector<int> v;
		for(int j = 1; j < n; j++){
			if((1<<i)&j)v.push_back(j+1);
		}
		st.clear();
		mul(get_pairise_xor(v));
		ss = st; st.clear();
		v.push_back(1);
		mul(get_pairise_xor(v));
		multiset<int>::iterator it;
		for(it = ss.begin(); it != ss.end(); it++){
			s.erase(s.lower_bound((*it)));
		}
		ka.clear();
		set<int>::iterator t;
		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(int i = 1; i < n; i++){
		int x = 0;
		m.clear();
		for(int j = 0; j < 10; j++){
			if((1<<j)&i) x++;
			for(int jj = 0; jj < ans[j].size(); jj++){
				if((1<<j)&i!=0) m[ans[j][jj]]++; else m[ans[j][jj]]--;
			}
		}
		for(tt = m.begin(); tt!=m.end(); tt++){
			if((*tt).second=x){
				pas.push_back(((*tt).first^f[0]));
				break;
			}
		}
	}
	return pas;
}

Compilation message

Xoractive.cpp: In function 'void mul(std::vector<int>)':
Xoractive.cpp:8:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for(int h = 0; h < q.size(); h++){
      |                 ~~^~~~~~~~~~
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:24:7: error: 'get_pairise_xor' was not declared in this scope; did you mean 'get_pairwise_xor'?
   24 |   mul(get_pairise_xor(v));
      |       ^~~~~~~~~~~~~~~
      |       get_pairwise_xor
Xoractive.cpp:30:4: error: 's' was not declared in this scope
   30 |    s.erase(s.lower_bound((*it)));
      |    ^
Xoractive.cpp:34:12: error: 's' was not declared in this scope
   34 |   for(it = s.begin(); it != s.end(); it++)ka.insert((*it));
      |            ^
Xoractive.cpp:42:3: error: 'm' was not declared in this scope
   42 |   m.clear();
      |   ^
Xoractive.cpp:45:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |    for(int jj = 0; jj < ans[j].size(); jj++){
      |                    ~~~^~~~~~~~~~~~~~~
Xoractive.cpp:46:16: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   46 |     if((1<<j)&i!=0) m[ans[j][jj]]++; else m[ans[j][jj]]--;
      |               ~^~~
Xoractive.cpp:49:7: error: 'tt' was not declared in this scope; did you mean 'st'?
   49 |   for(tt = m.begin(); tt!=m.end(); tt++){
      |       ^~
      |       st