답안 #618820

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
618820 2022-08-02T07:44:09 Z MetalPower Xoractive (IZhO19_xoractive) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#include "interactive.h"

// ask(i) := returns value at i
// get_pairwise_vector(vec) := returns a set of pairwise xor's

map<int, int> loc;

vector<int> guess(int n){

	int lst = ask(n);

	for(int bt = 0; bt < 7; bt++){

		vector<int> vec;
		for(int i = 0; i < n - 1; i++)
			if(i & (1 << bt)) vec.push_back(i + 1);
		
		vector<int> st = get_pairwise_vector(vec);
		vec.push_back(n);
		vector<int> fn = get_pairwise_vector(vec);

		vector<int> vals;
		for(int i = 0, j = 0; i < (int) st.size(); i++, j++){
			while(j < (int) fn.size() && fn[j] != st[i]) vals.push_back(fn[j++]);
		}

		for(int j = 1; j < (int) st.size(); j++) loc[st[j]] ^= 1 << bt;
	}

	vector<int> ans;
	ans.resize(n, 0);

	for(auto x : loc) ans[x.second] = x.first;
	ans[n - 1] = lst;
	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:21:20: error: 'get_pairwise_vector' was not declared in this scope; did you mean 'get_pairwise_xor'?
   21 |   vector<int> st = get_pairwise_vector(vec);
      |                    ^~~~~~~~~~~~~~~~~~~
      |                    get_pairwise_xor