# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
685109 | gagik_2007 | Xoractive (IZhO19_xoractive) | C++17 | 4 ms | 396 KiB |
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 "interactive.h"
#include <map>
using namespace std;
vector<int>sub(vector<int>a, vector<int>b) {
map<int, int>m;
for (int i : a)m[i]++;
for (int j : b)m[j]--;
vector<int>ans;
for (pair<int, int>p : m) {
for (int i = 0; i < p.second; i++)ans.push_back(p.first);
}
return ans;
}
vector<int> guess(int n) {
map<int, int>m;
int x = ask(1);
for (int i = 6; i >= 0; i--) {
vector<int>askk;
for (int j = 2; j <= n; j++) {
if (j & (1 << i))askk.push_back(j);
}
if (askk.size() == 0)continue;
vector<int>first = get_pairwise_xor(askk);
askk.push_back(1);
vector<int>second = get_pairwise_xor(askk);
second = sub(second, first);
for (int j = 0; j < second.size(); j++) {
second[j] ^= x;
m[second[j]] |= (1 << i);
}
}
int anss[1001];
for (pair<int, int>p : m) {
anss[p.second] = p.first;
}
anss[1] = x;
vector<int> ans;
for (int i = 1; i <= n; i++) {
ans.push_back(anss[i]);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |