| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 345508 | koketsu | Xoractive (IZhO19_xoractive) | C++14 | 0 ms | 0 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#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;
}
