#include "interactive.h"
#include <vector>
#include <set>
using namespace std;
multiset<int> query(vector<int> pos) {
multiset<int> sp;
for (int i : get_pairwise_xor(pos)) sp.insert(i);
return sp;
}
vector<int> guess(int n) {
vector<int> ret;
ret.push_back(ask(1));
set<int> in[7];
set<int> all;
for (int i = 0; i < 7; ++i) {
vector<int> B;
for (int j = 2; j <= n; ++j) {
if (((j >> i) & 1) == 0) continue;
B.push_back(j);
}
multiset<int> sp2 = query(B);
B.push_back(1);
multiset<int> sp1 = query(B);
sp1.erase(sp1.find(0));
for (int j : sp2) sp1.erase(sp1.find(j));
for (int j : sp1) {
in[i].insert(j ^= ret[0]);
all.insert(j);
}
}
for (int i = 2; i <= n; ++i) {
set<int> sp = all;
for (int j = 0; j < 7; ++j) {
if ((i >> j) & 1) continue;
for (int k : in[j]) {
auto it = sp.find(k);
if (it == sp.end()) continue;
sp.erase(it);
}
}
ret.push_back(*sp.begin());
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Not correct siz |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
504 KB |
Output is not correc |
2 |
Halted |
0 ms |
0 KB |
- |