제출 #175997

#제출 시각아이디문제언어결과실행 시간메모리
175997istleminXoractive (IZhO19_xoractive)C++14
100 / 100
9 ms404 KiB
#include "interactive.h"
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;

#define rep(i, a, b) for(ll i = a; i < ll(b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

vector<int> guess(int n) {
	ll d = ask(1);

	map<ll,ll> ind;

	rep(b,0,7){
		vi pos;
		rep(i,0,n){
			if((1<<b)&i) {
				pos.push_back(i+1);
				//cout<<i<<" ";
			}
		}
		if(sz(pos)==0) continue;
		//cout<<":"<<endl;
		vi res = get_pairwise_xor(pos);
		pos.push_back(1);
		vi resd = get_pairwise_xor(pos);

		trav(r,res) resd.erase(find(all(resd),r));

		sort(all(resd));
		for(ll i = 1; i<sz(resd);i+=2){
			ll val = resd[i]^d;
			ind[val] |= (1<<b);
			//cout<<val<<" ";
		}
		//cout<<endl;
	}

	vi ans(n);
	ans[0] = d;

	trav(x,ind){
		//cout<<x.second<<": "<<x.first<<endl;
		ans[x.second] = x.first;
	}

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