제출 #1313533

#제출 시각아이디문제언어결과실행 시간메모리
1313533orgiloogii동굴 (IOI13_cave)C++20
컴파일 에러
0 ms0 KiB
//#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int tryCombination(int S[]);
void answer(int S[], int D[]);

void exploreCave(int n) {
    int res[n];
    int state[n];
    for (int i = 0;i < n;i++) {
        state[i] = -1;
        res[i] = -1;
    }
    int temp[n];
    for (int i = 0;i < n;i++) {
        int onstate = -1;
        for (int j = 0;j < n;j++) {
            if (state[j] == -1) temp[j] = 0;
            else temp[j] = state[j];
        }
        int block = tryCombination(temp);
        if (block > i || block == -1) {
            onstate = 0;
        }
        else {
            onstate = 1;
        }
        int l = -1, r = n;
        while (l + 1 < r) {
            int mid = (l + r) / 2;
            for (int j = 0;j <= mid;j++) {
                if (state[j] == -1) temp[j] = onstate;
                else temp[j] = state[j];
            }
            for (int j = mid + 1;j < n;j++) {
                if (state[j] == -1) temp[j] = 1 - onstate;
                else temp[j] = state[j];
            }
            block = tryCombination(temp);
            if (block > i || block == -1) {
                r = mid;
            }
            else {
                l = mid;
            }
        }
        state[r] = onstate;
        res[r] = i;
    }
    answer(state, res);
}

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

/usr/bin/ld: /tmp/ccZJSQea.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
/usr/bin/ld: /tmp/ccADQ5VB.o: in function `exploreCave(int)':
cave.cpp:(.text+0x165): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x204): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x255): undefined reference to `answer(int*, int*)'
collect2: error: ld returned 1 exit status