제출 #257573

#제출 시각아이디문제언어결과실행 시간메모리
257573doowey질문 (CEOI14_question_grader)C++14
0 / 100
167 ms48152 KiB
#include <bits/stdc++.h>

using namespace std;

const int N = 940;
int mask[N];
int cnt = 0;

void gen(){
    for(int i = 0 ; i < (1 << 12); i ++ ){
        if(__builtin_popcount(i) == 6){
            mask[++cnt]=i;
        }
    }
}

int encode (int n, int x, int y) {
    gen();
    for(int i = 0 ; i < 12; i ++ ){
        if((mask[x] & (1 << i)) && !(mask[y] & (1 << i))){
            return i + 1;
        }
    }
    return -1;
}
#include <bits/stdc++.h>

using namespace std;

const int NN = 940;
int mi[NN];
int cc;

void gen0(){
    for(int i = 0; i < (1 << 12); i ++ ){
        if(__builtin_popcount(i) == 6){
            mi[++cc]=i;
        }
    }
}

int decode (int n, int q, int h) {
    gen0();
    int msk = mi[q];
    if((msk & (1 << h))) return false;
    else return true;
}
#Verdict Execution timeMemoryGrader output
Fetching results...