Submission #343349

# Submission time Handle Problem Language Result Execution time Memory
343349 2021-01-03T17:59:09 Z Tosic Xoractive (IZhO19_xoractive) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
void toMs(vector<int>& tmp, multiset<int>& ms){
	for(auto i : tmp){
        if(!i){
            continue;
        }
		ms.insert(i);
	}
}

map<int, int> idx;

vector<int> guess(int n){
    int fr = ask(1);
	for(int j = 0; j <= 6; ++j){
        vector<int >a1;
        for(int i = 2; i <= n; ++i){
            if((i>>j)&1){
                a1.push_back(i);
            }
        }
        vector<int>a2 = a1;
        if(a2.empty()){
            continue;
        }
        for(auto y : a1){
            cout << y << ' ';
        }
        cout << '\n';
        a2.push_back(1);
        a2=get_pairwise_xor(a2);
        a1=get_pairwise_xor(a1);
        multiset<int> tmp;
        toMs(a2, tmp);
        for(auto i : a1){
            if(i and tmp.find(i) != tmp.end()){
                tmp.erase(tmp.find(i));
            }
        }
        for(auto i = tmp.begin(); i != tmp.end(); ++i){
            idx[fr^*i] += (1<<j);
            ++i;
        }
    }
    vector<int> ans(n, 0);
    for(auto pr:idx){
        ans[pr.second-1] = pr.first;
    }
    ans [0] =fr;
    return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:15:14: error: 'ask' was not declared in this scope
   15 |     int fr = ask(1);
      |              ^~~
Xoractive.cpp:32:12: error: 'get_pairwise_xor' was not declared in this scope
   32 |         a2=get_pairwise_xor(a2);
      |            ^~~~~~~~~~~~~~~~