This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "interactive.h"
#include <set>
#include <iostream>
#include <algorithm>
#include <map>
#define ff first
#define ss second
using namespace std;
int base;
vector<int> getset(vector<int> v) {
vector<int> s1, s2, ret;
if (v.size() == 0) return ret;
s2 = get_pairwise_xor(v);
v.push_back(1);
s1 = get_pairwise_xor(v);
for (int i:s2) {
s1.erase(find(s1.begin(), s1.end(), i));
}
s1.erase(find(s1.begin(), s1.end(), 0));
for (int i:s1) {
if (find(ret.begin(), ret.end(), i) == ret.end()) ret.push_back(i);
}
for (int &i:ret) i ^= base;
return ret;
}
map<int, int> mp;
vector<int> guess(int n) {
vector <int> ans (n, 0);
base = ask(1);
for (int i = 0;i < 7;i++) {
vector<int> que;
for (int j = 2;j <= n;j++) {
if (j & (1<<i)) que.push_back(j);
}
vector<int> res = getset(que);
for (int j:res) {
mp[j] += 1<<i;
}
}
ans[0] = base;
for (auto i:mp) {
//cout << i.ff << " " << i.ss << endl;
ans[i.ss - 1] = i.ff;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |