#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
vector<int> guess(int n) {
vector <int> ans;
int x = ask(1);
ans.push_back(x);
set<int> all, s[7];
for(int bit = 0; bit < 7; ++bit) {
vector<int> to_ask;
for(int i = 2; i <= n; ++i) {
if(i >> bit & 1) {
to_ask.push_back(i);
}
}
vector<int> xors_without_1 = get_pairwise_xor(to_ask);
to_ask.push_back(1);
vector<int> xors_with_1 = get_pairwise_xor(to_ask);
map<int,int> freq;
for(int i : xors_without_1) freq[i]++;
for(int x : xors_with_1) {
if(freq[x] == 0) {
s[bit].insert(x);
all.insert(x);
} else {
--freq[x];
}
}
}
for(int i = 2; i <= n; ++i) {
for(int val : all) {
if(!val) continue;
bool ok = true;
for(int bit = 0; bit < 7; ++bit) {
if(i >> bit & 1) {
if(s[bit].find(val) == s[bit].end()) {
ok = false;
}
}
}
if(ok) {
ans.push_back(val);
break;
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Not correct size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
364 KB |
Output is not correct |
2 |
Halted |
0 ms |
0 KB |
- |