제출 #520834

#제출 시각아이디문제언어결과실행 시간메모리
520834RainbowbunnyXoractive (IZhO19_xoractive)C++17
94 / 100
5 ms456 KiB
#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 40005;

map <int, int> M;

vector<int> guess(int n) 
{

	vector <int> ans(n);
	ans[0] = ask(1);

	for(int i = 0; i < 7; i++)
	{
		vector <int> id;
		for(int j = 2; j <= n; j++)
		{
			if(j & (1 << i))
			{
				id.push_back(j);
			}
		}

		vector <int> get1, get2;

		get1 = get_pairwise_xor(id);
		id.push_back(1);
		get2 = get_pairwise_xor(id);

		map <int, int> MM;
		for(auto x : get1)
		{
			MM[x]++;
		}

		for(auto x : get2)
		{
			MM[x]--;
			if(MM[x] == -1)
			{
				if(x != 0)
				{
					M[x ^ ans[0]] |= (1 << i);
				}
			}
		}
	}

	for(auto x : M)
	{
		ans[x.second - 1] = x.first;
	}

	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...