#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;
map<int,int> pos;
vector<int> guess(int n) {
vector<int> ans=vector<int>(n);
ans[0]=ask(1);
for(int i=0;i<=6;i++)
{
vector<int> v;
for(int j=2;j<=n;j++)
{
if(j&(1<<i))
v.push_back(j);
}
if(!v.size()) continue;
vector<int> r1=get_pairwise_xor(v);
v.push_back(1);
vector<int> r2=get_pairwise_xor(v);
map<int,int> mp;
for(int x:r2)
mp[x]++;
for(int x:r1)
mp[x]--;
for(auto x:mp)
{
if(x.second==0) continue;
pos[x.first^ans[0]]|=(1<<i);
}
}
for(auto i:pos)
ans[i.second-1]=i.first;
return ans;
/*vector <int> ans;
for (int i = 1; i <= n; i++) {
ans.push_back(ask(i));
}
return ans;*/
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
380 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
376 KB |
Output is not correct |
2 |
Halted |
0 ms |
0 KB |
- |