답안 #336557

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336557 2020-12-15T16:36:21 Z amunduzbaev Xoractive (IZhO19_xoractive) C++14
0 / 100
5 ms 492 KB
#include "interactive.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ll long long 
#define ld long double 
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define prc(n) fixed << setprecision(n)
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1);
const int inf = 1e9+7;
const int N = 105;
 
vector<int> guess(int n){
	int fir = ask(1);
	vector<set<int>>a(10);
	for(int i=0;i<8;i++){
		vector<int>tmp;
		vector<int>ans, ans1;
		for(int j=2;j<=n;j++) if((1 << i) & j){
			tmp.pb(j);
		}
		if(tmp.empty()) continue;
		ans = get_pairwise_xor(tmp);
		tmp.pb(1);
		ans1 = get_pairwise_xor(tmp);
		multiset<int>ss;
		
		for(int j=0; j<sz(ans1); j++) ss.insert(ans1[j]);
		for(int j=0; j<sz(ans); j++) ss.erase(ss.find(ans[j]));
		for(auto x = ss.begin(); x != ss.end(); x++){
			int xx = *x;
			xx ^= fir;
			a[i].insert(xx);
		}
	}
	vector<int>ans(n);
	ans[0] = fir;
	for(int i=1;i<n;i++){
		int j = 0, l = 0;
		while(sz(a[j]) == 0 && j < 10) j++;
		if(j == 10) break;
		int cur = *a[j].begin();
		int in = 0;
		for(l = 0;l<7;l++){
			if(a[l].find(cur) != a[l].end()){
				a[l].erase(cur);
				in += (1<<l);
			}
		}
		ans[in -1] = cur;
	}
	 //for(int i=0;i<n;i++) cout<<ans[i]<<" ";
	//cout<<endl;
	return ans;
}
/*

20
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB Output is not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 492 KB Output is not correct
2 Halted 0 ms 0 KB -