This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include"interactive.h"
using namespace std;
#define all(x) x.begin(), x.end()
using ll = long long;
vector<int> guess(int n) {
map<int, int> mp;
int c0 = ask(1);
mp[c0] = 1;
for (int h = 0; h < 7; ++h) {
vector<int> qq;
for (int i = 2; i <= n; ++i) {
if (i >> h & 1) qq.push_back(i);
}
if (qq.empty()) continue;
map<int, int> mp1, mp2;
{
vector<int> vals = get_pairwise_xor(qq);
for (auto i: vals) mp1[i]++;
for (int i = 0; i < qq.size(); ++i) mp1[0]--;
for (auto &[x, y]: mp1) y /= 2;
}
qq.push_back(1);
{
vector<int> vals = get_pairwise_xor(qq);
for (auto i: vals) mp2[i]++;
for (int i = 0; i < qq.size(); ++i) mp2[0]--;
for (auto &[x, y]: mp2) y /= 2;
}
for (auto [x, y]: mp1) mp2[x] -= y;
for (auto [x, y]: mp2) {
if (y) {
mp[x ^ c0] |= 1 << h;
}
}
cout << endl;
}
vector<int> ans(n);
for (auto [x, y]: mp) ans[y - 1] = x;
return ans;
}
Compilation message (stderr)
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:22:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for (int i = 0; i < qq.size(); ++i) mp1[0]--;
| ~~^~~~~~~~~~~
Xoractive.cpp:29:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for (int i = 0; i < qq.size(); ++i) mp2[0]--;
| ~~^~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |