Submission #202396

# Submission time Handle Problem Language Result Execution time Memory
202396 2020-02-16T03:07:36 Z klungs Xoractive (IZhO19_xoractive) C++14
6 / 100
11 ms 504 KB
#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;

vector <int> ans;

vector<int> contains(vector<int> q) {
	if (q.size() == 0) return {};
	vector<int> qf = q;
	qf.push_back(1);
	auto res1 = get_pairwise_xor(qf);
	auto res2 = get_pairwise_xor(q);
	set<int> gg (res1.begin(), res1.end());
	for (auto x : res2) gg.erase(x);
	gg.erase(ans[1]);
	auto res = vector<int>(gg.begin(), gg.end());
	for (auto &x : res) x ^= ans[1];
	return res;
}

vector<int> guess(int n) {
	ans.resize(n + 1);
	ans[1] = ask(1);
	
	vector<int> questions[7], answers[7];
	
	vector<int> question_all(n - 1);
	iota(question_all.begin(), question_all.end(), 2);
	vector<int> all = contains(question_all);
	map<int, int> id;
	for (auto i : all) {
		id[i] = 0;
	}
	
	for (int i = 2; i <= n; i++) {
		for (int j = 0; j < 7; j++) if ((1 << j) & i) {
			questions[j].push_back(i);
		}
	}
	
	for (int j = 0; j < 7; j++) {
		answers[j] = contains(questions[j]);
		for (int x : answers[j]) {
			id[x] ^= (1 << j);
		}
	}
	
	for (auto x : id) {
		ans[x.second] = x.first;
	}
	
	// for (int i = 1; i <= n; i++) {
	// 	int num = ask(i);
	// 	cnt[num]++;
	// 	ans.push_back(num);
	// 	// assert(cnt[num] <= 1);
	// }
	vector<int> fix_ans(ans.begin() + 1, ans.end());
	return fix_ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 11 ms 504 KB Output is partially correct
2 Partially correct 11 ms 504 KB Output is partially correct
3 Incorrect 8 ms 504 KB Output is not correct
4 Halted 0 ms 0 KB -