#include "bits/stdc++.h"
#include "interactive.h"
using namespace std;
const int maxn=105;
int fir;
set<int>arr[maxn];
set<int>A(vector<int>v){
if(v.empty()) return set<int>();
// for(auto i : v) cout<<i<<' ';
// cout<<" ----> ";
vector<int>now = v;
now.push_back(1);
vector<int>nw = get_pairwise_xor(now);
vector<int>z = get_pairwise_xor(v);
// for(auto i : nw) cout<<i<<' ';
// cout<<" ----> ";
// for(auto i : z) cout<<i<<' ';
// cout<<" ----> ";
multiset<int>SS(nw.begin(),nw.end());
for(auto i : z) SS.erase(SS.find(i));
// for(auto i : SS) cout<<i<<' ';
// cout<<" ---> ";
set<int>jg;
for(auto i : SS) jg.insert(i ^ fir);
jg.erase(fir);
// for(auto i : jg) cout<<i<<' ';
// cout<<'\n';
return jg;
}
set<int>un(set<int>A,set<int>B){
set<int>jog;
for(auto i : A) if(B.find(i) != B.end()) jog.insert(i);
return jog;
}
vector<int> guess(int n) {
fir = ask(1);
for(int i = 0;i <= 6;i++){
vector<int>now;
for(int j = 2;j <= n;j++) if((1 << i) & j) now.push_back(j);
arr[i] = A(now);
}
vector<int>ans; ans.push_back(fir);
for(int i = 2;i <= n;i++){
set<int>now;
for(int j = 0;j <= 6;j++) if((1<<j) & i){
if(now.empty()) now = arr[j];
else now = un(now,arr[j]);
}
assert(!now.empty());
ans.push_back(*now.begin());
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Incorrect |
0 ms |
200 KB |
Output is not correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
328 KB |
Output is not correct |
2 |
Halted |
0 ms |
0 KB |
- |