Submission #336549

# Submission time Handle Problem Language Result Execution time Memory
336549 2020-12-15T15:35:25 Z amunduzbaev Xoractive (IZhO19_xoractive) C++14
6 / 100
4 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<7;i++){
		vector<int>tmp;
		vector<int>ans, ans1;
		for(int j=2;j<=n;j++){
			if((1 << i) & j) tmp.pb(j);
		}
		if(sz(tmp) == 0) continue;
		ans = get_pairwise_xor(tmp);
		tmp.pb(1);
		ans1 = get_pairwise_xor(tmp);
		set<int>ss;
		for(int i=0;i<sz(ans1);i++) ss.insert(ans1[i]);
		for(int i=0;i<sz(ans);i++) ss.erase(ans[i]);
		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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Runtime error 3 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -