제출 #1161991

#제출 시각아이디문제언어결과실행 시간메모리
1161991jmuzhenUnscrambling a Messy Bug (IOI16_messy)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.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.cpp: In function 'void restore_permutation(int, int, int, int*)':
messy.cpp:8:5: error: 'add_element' was not declared in this scope
    8 |     add_element(element0);
      |     ^~~~~~~~~~~
messy.cpp:17:5: error: 'compile_set' was not declared in this scope
   17 |     compile_set();
      |     ^~~~~~~~~~~
messy.cpp:23:13: error: 'check_element' was not declared in this scope
   23 |         if (check_element(query)) {
      |             ^~~~~~~~~~~~~
messy.cpp:37:17: error: 'check_element' was not declared in this scope
   37 |             if (check_element(query)) {
      |                 ^~~~~~~~~~~~~
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
      |         ^~~~