답안 #1010133

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1010133 2024-06-28T11:01:20 Z giorgi123glm Xoractive (IZhO19_xoractive) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main () {
    long long k = 0;
    cin >> k;

    int largestbit = 0;
    for (int i = 60; i >= 0; i--)
        if ((k & (1ll << i))) {
            largestbit = i;
            break;
        }
    
    k = (k ^ (1ll << largestbit));
    
    int siz = max (
        largestbit + 1,
        5
    );

    vector <string> gr (siz, string (siz, '.'));
    
    for (int i = 0; i < largestbit; i++) {
        gr[i][i] = 'X';
        gr[i + 1][i] = 'r';
        gr[i][i + 1] = 'd';
    }

    for (int i = 0; i < siz - 1; i++) {
        gr[siz - 1][i] = 'r';
        gr[i][siz - 1] = 'd';
    }

    for (int i = 2; i < largestbit; i++)
        if ((k & (1ll << i))) {
            gr[i][i - 1] = 'X';
            gr[i - 1][i] = 'X';
        }
    
    if ((k & 2ll) && (k & 1ll)) {
        gr[1][0] = 'X';
        gr[0][1] = 'X';

        gr[siz - 2][0] = 'X';
        gr[siz - 2][1] = 'd';
    } else if ((k & 2ll)) {
        gr[1][0] = 'X';
        gr[0][1] = 'X';
    } else if ((k & 1ll)) {
        gr[1][0] = 'X';
    }
    
    cout << siz << ' ' << siz << '\n';
    for (int y = 0; y < siz; y++)
        cout << gr[y] << '\n';
}

Compilation message

/usr/bin/ld: /tmp/ccFHG0lN.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccSfh8PK.o:Xoractive.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccFHG0lN.o: in function `main':
grader.cpp:(.text.startup+0xdc): undefined reference to `guess(int)'
collect2: error: ld returned 1 exit status