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 <bits/stdc++.h>
#include "interactive.h"
using namespace std;
int q1;
int N;
multiset<int> _S[7];
set<int> S[7];
void get(int x){
vector<int> v;
for (int i = 2; i <= N; i++){
if (i>>x&1) v.push_back(i);
}
if (v.size() == 0){
return;
}
vector<int> o1 = get_pairwise_xor(v);
v.push_back(1);
vector<int> o2 = get_pairwise_xor(v);
for (auto c : o2) {
_S[x].insert(c^q1);
}
for (auto c : o1) _S[x].erase(_S[x].find(c^q1));
for (auto c : _S[x]){
if (_S[x].count(c) == 2){
S[x].insert(c);
}
}
/*printf("set %d: ",x);
for (auto c : S[x]) printf("%d ",c);
printf("\n");*/
}
vector<int> guess(int n) {
N = n;
q1 = ask(1);
for (int i = 0; i <= 6; i++){
get(i);
}
vector<int> ans(n);
set<int> fin;
for (int i = 0; i <= 6; i++) for (auto c : S[i]) fin.insert(c);
for (auto x : fin){
int id = 0;
for (int i = 0; i <= 6; i++){
if (S[i].find(x) != S[i].end()) id += (1<<i);
}
//printf("id of %d is %d\n",x,id);
ans[id-1] = x;
}
ans[0] = q1;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |