답안 #770528

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -