Submission #551509

# Submission time Handle Problem Language Result Execution time Memory
551509 2022-04-20T22:16:29 Z Olympia Xoractive (IZhO19_xoractive) C++17
0 / 100
2 ms 336 KB
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <map>
#include <complex>
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <set>
#include <queue>
#include"interactive.h"
using namespace std;

vector<int> reduce (vector<int> v) {
    map<int,int> cnt;
    for (int i: v) {
        cnt[i]++;
    }
    cnt[0] = 0;
    v.clear();
    for (auto& p: cnt) {
        p.second /= 2;
        while (p.second--) {
            v.push_back(p.first);
        }
    }
    return v;
}
int beginning;
vector<int> permutation (vector<int> indices, int n) {
    vector<int> v1 = reduce(get_pairwise_xor(indices));
    indices.push_back(n - 1);
    vector<int> v2 = reduce(get_pairwise_xor(indices));
    map<int,int> cnt;
    for (int i: v2) cnt[i]++;
    for (int i: v1) cnt[i]--;
    vector<int> v;
    for (auto& p: cnt) {
        if (p.second)
        v.push_back(p.first ^ beginning);
    }
    sort(v.begin(), v.end());
    return v;
}
vector<int> guess (int n) {
    beginning = ask(n);
    map<int,int> m;
    for (int i = 0; i < 7; i++) {
        vector<int> x;
        for (int j = 0; j < n - 1; j++) {
            if ((j + 1) & (1 << i)) {
                x.push_back(j + 1);
            }
        }
        vector<int> a = permutation(x, n);
        for (int val: a) {
            m[val] |= (1 << i);
        }
    }
    vector<int> ans(n);
    for (auto& p: m) {
        ans[p.second - 1] = p.first;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not unique
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Not unique
2 Halted 0 ms 0 KB -