제출 #1325235

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

template<typename T>
using V = vector<T>;

const int B = 12;
int TP, n, t, x, y, q, h;

V<int> s;

int main() {
    for (int i = 0; i < (1 << B); i++) {
        if (__builtin_popcount(i) == B / 2) {
            s.push_back(i);
        }
    }

    cin >> TP;
    if (TP == 1) {
        cin >> n >> t;
        while (t--) {
            cin >> x >> y;
            for (int i = 0; i < B; i++) {
                if ((s[x] & (1 << i)) && !(s[y] & (1 << i))) {
                    cout << (i + 1) << endl; // If s[q] contains i, "yes"
                    break;
                }
            }
        }
    } else {
        cin >> n >> t;
        while (t--) {
            cin >> q >> h;
            h--;
            if (s[q] & (1 << h)) {
                cout << "yes" << endl;
            } else {
                cout << "no" << endl;
            }
        }
    }
}
#include <bits/stdc++.h>
using namespace std;

template<typename T>
using V = vector<T>;

const int B = 12;
int TP, n, t, x, y, q, h;

V<int> s;

int main() {
    for (int i = 0; i < (1 << B); i++) {
        if (__builtin_popcount(i) == B / 2) {
            s.push_back(i);
        }
    }

    cin >> TP;
    if (TP == 1) {
        cin >> n >> t;
        while (t--) {
            cin >> x >> y;
            for (int i = 0; i < B; i++) {
                if ((s[x] & (1 << i)) && !(s[y] & (1 << i))) {
                    cout << (i + 1) << endl; // If s[q] contains i, "yes"
                    break;
                }
            }
        }
    } else {
        cin >> n >> t;
        while (t--) {
            cin >> q >> h;
            h--;
            if (s[q] & (1 << h)) {
                cout << "yes" << endl;
            } else {
                cout << "no" << endl;
            }
        }
    }
}

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

# 1번째 컴파일 단계

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