제출 #1133953

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

#define ll long long
#define N 200005
#define pb push_back
#define ff first
#define ss second
#define sz(s) (int)s.size()

int val;
vector <int> a, b;
vector <pair<int,int> > answer;
map <int,int> vis, vip;

vector <int> guess(int n) {
	val = ask(n);
	for(int i = 0; i <= 7; i++) {
		b.clear();
		vip.clear();
		for(int j = 1; j < n; j++) {
			if((j & (1 << i))) b.pb(j);
		}
		if(!sz(b)) continue;
		vector <int> a1 = get_pairwise_xor(b);
		b.pb(n);
		vector <int> a2 = get_pairwise_xor(b);
		for(auto j : a1) {
			vip[j]++;
		}
		for(auto j : a2) {
			vip[j]--;
		}
		for(auto j : vip) {
			if(j.ff && j.ss)
			vis[j.ff ^ val] |= (1 << i);
		}
	}
	for(auto i : vis) {
		answer.pb({i.ss,i.ff});
	}
	sort(answer.begin(),answer.end());
	for(auto i : answer) {
		a.pb(i.ss);
	}
	a.pb(val);
	return a;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...