제출 #1325140

#제출 시각아이디문제언어결과실행 시간메모리
1325140pfang질문 (CEOI14_question_grader)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

#define int long long 
// bitset!!! at positon 1-12 somewhere, when it first differs x and y, we can check that position checking is 4096, we are
// overcounting. 12 choose 6 924, avoids collisions
// issue we are having: all 1s in x are in y, cannot determine whethe rit is x or y who is the one we want
// how do we use 
// 000000111111  12 choose 6 1s or 0s
// each num from 1 to 920 has a mask. we guarentee that x has a bit = 1 while y has a bit = 0? x != y 

vector<int> masker(925); // this is N -> mask translator 

void query1(){ // check when mask of x and y differ by a bit
    int n, t;
    cin >> n >> t;
    while(t--){
        int x, y;
        cin >> x >> y;
        for(int h = 1; h <= 12; h++){
            if( ((masker[x] >> (h-1)) & 1) == 1 && ((masker[y] >> (h-1)) & 1) == 0){
                // first difference, place we can differentiate.
                cout << h << '\n';
                break;
            }
        }
    }
}

void query2(){
    int n, t;
    cin >> n >> t;
    while(t--){
        int q, h;
        cin >> q >> h;
        if(masker[q] >> (h - 1)){
            cout << "yes\n";
        }else{
            cout << "no\n";
        }
    }
}

void precompute(){
    vector<int> masks;
    for(int mask = 0; mask < (1 << 12); mask++){
        if(__builtin_popcount(mask) == 6){
            masks.push_back(mask);
        }
    }
    masker.push_back(-1); // 0-> -1, we dont care
    for(int i = 1; i <= 920; i++){
        masker[i] = masks[i-1];
    }
}

int32_t main(){
    precompute();
    int type;
    cin >> type;
    query1();
}
#include <bits/stdc++.h>

using namespace std;

#define int long long 
// bitset!!! at positon 1-12 somewhere, when it first differs x and y, we can check that position checking is 4096, we are
// overcounting. 12 choose 6 924, avoids collisions
// issue we are having: all 1s in x are in y, cannot determine whethe rit is x or y who is the one we want
// how do we use 
// 000000111111  12 choose 6 1s or 0s
// each num from 1 to 920 has a mask. we guarentee that x has a bit = 1 while y has a bit = 0? x != y 

vector<int> masker(925); // this is N -> mask translator 

void query1(){ // check when mask of x and y differ by a bit
    int n, t;
    cin >> n >> t;
    while(t--){
        int x, y;
        cin >> x >> y;
        for(int h = 1; h <= 12; h++){
            if( ((masker[x] >> (h-1)) & 1) == 1 && ((masker[y] >> (h-1)) & 1) == 0){
                // first difference, place we can differentiate.
                cout << h << '\n';
                break;
            }
        }
    }
}

void query2(){
    int n, t;
    cin >> n >> t;
    while(t--){
        int q, h;
        cin >> q >> h;
        if(masker[q] >> (h - 1)){
            cout << "yes\n";
        }else{
            cout << "no\n";
        }
    }
}

void precompute(){
    vector<int> masks;
    for(int mask = 0; mask < (1 << 12); mask++){
        if(__builtin_popcount(mask) == 6){
            masks.push_back(mask);
        }
    }
    masker.push_back(-1); // 0-> -1, we dont care
    for(int i = 1; i <= 920; i++){
        masker[i] = masks[i-1];
    }
}

int32_t main(){
    precompute();
    int type;
    cin >> type;
    query2();
}

컴파일 시 표준 에러 (stderr) 메시지

# 1번째 컴파일 단계

/usr/bin/ld: /tmp/ccQ26N7A.o: in function `main':
grader_encode.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccoGHN8i.o:encoder.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccQ26N7A.o: in function `main':
grader_encode.c:(.text.startup+0x13a): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status