# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370891 | daniel920712 | Xoractive (IZhO19_xoractive) | C++14 | 5 ms | 640 KiB |
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 <stdio.h>
#include <vector>
#include <set>
#include <map>
using namespace std;
set < int > all;
map < int , int > A;
map < int , int > B;
map < int , int > xx;
bool have[105];
set < int > AA;
set < int > BB;
set < int > bit[15][15];
vector < int > how;
vector < int > ans;
vector < int > tt;
vector < int > tt2;
void F2(int here)
{
int i,j;
A.clear();
B.clear();
tt.clear();
for(auto i:how)
{
//printf("%d\n",i);
tt.push_back(i+1);
}
tt2=get_pairwise_xor(tt);
for(auto i:tt2) if(i) A[i]++;
tt.clear();
for(auto i:how) if(i) tt.push_back(i+1);
tt2=get_pairwise_xor(tt);
for(auto i:tt2) if(i) A[i]--;
bit[0][here].insert(ans[0]);
for(auto i:A)
{
for(j=0;j<i.second/2;j++) bit[0][here].insert(i.first^ans[0]);
}
for(auto i:bit[0][here]) if(i!=ans[0]) xx[i]+=(1<<here);
}
vector<int> guess(int N)
{
int i,j,big=0;
for(i=0;i<N;i++) ans.push_back(0);
if(N<=2)
{
for(i=0;i<N;i++) ans[i]=ask(i+1);
return ans;
}
else
{
ans[0]=ask(1);
for(i=0;i<10;i++)
{
how.clear();
how.push_back(0);
for(j=0;j<N;j++)
{
if((j&(1<<i)))
{
how.push_back(j);
}
}
if(how.size()==1) break;
F2(i);
}
for(auto i:xx) ans[i.second]=i.first;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |