Submission #770528

# Submission time Handle Problem Language Result Execution time Memory
770528 2023-07-01T11:59:47 Z rxlfd314 Xoractive (IZhO19_xoractive) C++17
6 / 100
3 ms 336 KB
#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> guess(int N) {
	vector<int> ans(N);
	ans[0] = ask(1);
	map<int, int> inds;
	for (int j = 0; (1 << j) <= N; j++) {
		vector<int> v;
		for (int i = 0; i < N; i++) {
			if (i & 1 << j) {
				v.push_back(i+1);
			}
		}
		if (!v.size()) continue;
		vector<int> a = get_pairwise_xor(v);
		v.push_back(1);
		vector<int> b = get_pairwise_xor(v);
		set<int> s(b.begin(), b.end());
		for (int i : a) {
			if (s.count(i)) {
				s.erase(i);
			}
		}
		for (int i : s) {
			if (i) {
				inds[i^ans[0]] += 1 << j;
			}
		}
	}
	for (auto [a, b] : inds) {
		ans[b] = a;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Incorrect 2 ms 336 KB Output is not correct
4 Halted 0 ms 0 KB -