제출 #345509

#제출 시각아이디문제언어결과실행 시간메모리
345509koketsuXoractive (IZhO19_xoractive)C++14
0 / 100
7 ms1004 KiB
#include "interactive.h"
#include <iostream>
#include <set>
#include <map>
#define LL long long
#define pb push_back

using namespace std;

int Ans[101];

vector <int> Pos[101], Boo[101];

multiset <int> get(int A){
    vector <int> E = get_pairwise_xor(Pos[A]);
    multiset <int> Q;
    for(int i : E){
        Q.insert(i);
    }
    return Q;
}

vector <int> guess(int n){
    int A = ask(1);
    Ans[true] = A;
    for(int i = 0; i < 7; i++){
        for(int j = 2; j <= n; j++){
            if(j & (1 << i)) Pos[i].pb(j);
        }
    }
    for(int i = 0; i < 7; i++){
        if(!Pos[i].size()) continue;
        multiset <int> A1 = get(i);
        Pos[i].pb(1);
        multiset <int> A2 = get(i);
        //A2.erase(A2.find(0));
        for(auto it : A1){
            A2.erase(A2.find(it));
        }
        for(auto it : A2){
            Boo[i].pb(it ^ Ans[1]);
        }
    }
    map <int, int> Mp;
    for(int i = 0; i < 7; i++){
        for(int j : Boo[i]){
            Mp[j] |= j;
        }
    }
    for(int i = 0; i < 7; i++){
        for(int j : Boo[i]){
            Ans[Mp[j]] = j;
        }
    }
    vector <int> Dum;
    for(int i = 1; i <= n; i++){
        Dum.pb(Ans[i]);
    }
    return Dum;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...