Submission #566342

# Submission time Handle Problem Language Result Execution time Memory
566342 2022-05-22T08:59:38 Z Stickfish Xoractive (IZhO19_xoractive) C++17
0 / 100
5 ms 336 KB
#include "interactive.h"
#include <map>
using namespace std;

map<int, int> ra;

map<int, int> ask_compr(vector<int> pos) {
    for (auto& x : pos)
        ++x;
    vector<int> ansv = get_pairwise_xor(pos);
    map<int, int> ansmp;
    for (auto x : ansv)
        ++ansmp[x];
    return ansmp;
}

void get_bit(int n, int bt) {
    vector<int> pos;
    for (int i = 0; i < n; ++i) {
        if (i & bt)
            pos.push_back(i);
    }
    map<int, int> mp0 = ask_compr(pos);
    pos.push_back(n);
    map<int, int> mp1 = ask_compr(pos);
    for (auto [x, cnt] : mp1) {
        if (cnt > mp0[x]) {
            ra[x] += bt;
        }
    }
}

vector<int> guess(int n) {
    vector<int> ans(n);
    ans[n - 1] = ask(n);
    for (int bt = 1; bt + 1 < n; bt *= 2) {
        get_bit(n - 1, bt);
    }
    for (auto [avl, i] : ra)
        ans[i] = avl;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output is not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 336 KB Output is not correct
2 Halted 0 ms 0 KB -