제출 #1161994

#제출 시각아이디문제언어결과실행 시간메모리
1161994jmuzhenUnscrambling a Messy Bug (IOI16_messy)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "messy.h"

using namespace std;

void restore_permutation(int n, int w, int r, int* result) {
    string element0(n, '0');
    element0[0] = '1';
    add_element(element0);
    
    for (int i = 0; i < n - 1; ++i) {
        string element(n, '0');
        element[i] = '1';
        element[i + 1] = '1';
        add_element(element);
    }
    
    compile_set();
    
    // find p[0]
    for (int j = 0; j < n; ++j) {
        string query(n, '0');
        query[j] = '1';
        if (check_element(query)) {
            result[0] = j;
            break;
        }
    }
    
    for (int i = 0; i < n - 1; ++i) {
        int prev = result[i];
        for (int j = 0; j < n; ++j) {
            if (j == prev) continue;
            string query(n, '0');
            query[prev] = '1';
            query[j] = '1';
            query[n] = '\0';
            if (check_element(query)) {
                result[i + 1] = j;
                break;
            }
        }
    }
}

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

messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
/usr/bin/ld: /tmp/cct7BZiK.o: in function `main':
grader.cpp:(.text.startup+0x19f): undefined reference to `restore_permutation(int, int, int)'
collect2: error: ld returned 1 exit status