#include<bits/stdc++.h>
#include "interactive.h"
//#include "grader.cpp"
using namespace std;
int i,j,p,q,n,m,k;
map <int,int> who;
multiset <int> turn(vector <int> v)
{
multiset <int> s;
for(auto iii:v)
s.insert(iii);
return s;
}
vector <int> guess(int n)
{
vector <int> ans(n);
int first_element = ask(1);
set <int> all;
for(int ii=0;ii<7;ii++)
{
vector <int> current;
for(j=2;j<=n;j++)
{
if(((1<<ii)&j))
current.push_back(j);
}
if(current.empty())
break;
multiset <int> s1 = turn(get_pairwise_xor(current));
current.push_back(1);
multiset <int> s2 = turn(get_pairwise_xor(current));
set <int> now;
for(auto i:s2)
{
if(s1.find(i)==s1.end())
now.insert(i);
}
for(auto i:now)
{
//cout<<ii<<" "<<(i^first_element)<<endl;
all.insert(i);
//cout<<all.size()<<endl;
who[i]|=(1<<ii);
}
}
for(auto i:all)
ans[who[i]-1] = (i^first_element);
ans[0] = first_element;
return ans;
}
/*
4
1 5 6 3
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
600 KB |
Output is correct |
2 |
Correct |
5 ms |
600 KB |
Output is correct |
3 |
Incorrect |
4 ms |
600 KB |
Output is not correct |
4 |
Halted |
0 ms |
0 KB |
- |