Submission #1127437

#TimeUsernameProblemLanguageResultExecution timeMemory
1127437heeheeheehaawXoractive (IZhO19_xoractive)C++20
6 / 100
1 ms408 KiB
#include <bits/stdc++.h>
#include "interactive.h"

using namespace std;

vector<int> guess(int n)
{
    if(n <= 14)
    {
        vector <int> ans;
        for (int i = 1; i <= n; i++)
        {
            ans.push_back(ask(i));
        }
        return ans;
    }

    vector<int> v(n);
    v[0] = ask(1);
    map<int, int> poz;
    for(int bit = 6; bit >= 0; bit--)
    {
        vector<int> a;
        for(int i = 2; i <= n; i++)
        {
            if(((1 << bit) & i) == 1)
                a.push_back(i);
        }

        vector<int> a2 = a;
        a2.push_back(1);
        vector<int> b2 = get_pairwise_xor(a2);
        vector<int> b = get_pairwise_xor(a);
        map<int, int> mp;
        for(auto it : b2) mp[it]++;
        for(auto it : b) mp[it]--;
        mp[0]--;
        for(auto it : mp)
        {
            if(it.first == 0) continue;
            poz[it.first ^ v[0]] += (1 << bit);
        }
    }

    for(auto it : poz)
        v[it.second - 1] = it.first;
    return v;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...