답안 #555787

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
555787 2022-05-01T14:30:45 Z ngpin04 Xoractive (IZhO19_xoractive) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#include "interactive.h"
//#include "grader.cpp"
using namespace std;

map <int, int> pos;

void solve(int i, vector <int> p, int r) {
	map <int, int> cnt;
	vector <int> tmp = get_pairwise_xor(p);
	for (int x : tmp)
		cnt[x]--;

	p.push_back(n);
	tmp = get_pairwise_xor(p);
	for (int x : tmp) {
		cnt[x]++;
		if (cnt[x] > 0)
			pos[x ^ r] |= (1 << i);
	}
}

vector<int> guess(int n) {
	int r = ask(n);
	for (int j = 0; j < 7; j++) {
		vector <int> p;
		for (int i = 1; i < n; i++)
			if (i & (1 << j))
				p.push_back(i);

		if (!p.size())
			continue;
		solve(j, p, r);
	}	

	vector <int> ans(n, 0);

	for (pair <int, int> pir : pos) 
		if (pir.fi != r)
			ans[pir.se - 1] = pir.fi;
	ans[n - 1] = r;	
	return ans;
}

Compilation message

Xoractive.cpp: In function 'void solve(int, std::vector<int>, int)':
Xoractive.cpp:17:14: error: 'n' was not declared in this scope
   17 |  p.push_back(n);
      |              ^