제출 #890058

#제출 시각아이디문제언어결과실행 시간메모리
890058Sorting동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <stack>
#include <cmath>
#include <iomanip>
#include <cassert>

using namespace std;

typedef long long ll;

void answer(int S[], int D[]);
int tryCombination(int S[]);

void exploreCave(int n){
    int s[6000], d[6000];

    vector<int> active(n);
    iota(active.begin(), active.end(), 0);

    for(int i = 0; i < n; ++i){
        int l = 0, r = active.size() - 1;

        int prv = tryCombination(s);

        while(l != r){
            int mid = (l + r + 1) >> 1;

            for(int i = 0; i <= mid; ++i)
                s[active[i]] = 1;
            for(int i = mid; i < n; ++i)
                s[active[i]] = 0;

            if((tryCombination(s) == i) != (prv == i)){
                l = mid;
            }
            else{
                r = mid - 1;
            }
        }

        int key = active[l];
        active.erase(find(active.begin(), active.end(), key));

        if(prv == i){
            s[key] = 1;
            d[key] = i;
        }
    }
    answer(s, d);
}

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

/usr/bin/ld: /tmp/ccWSRHZ0.o: in function `exploreCave(int)':
cave.cpp:(.text+0xfd): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x180): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x24d): undefined reference to `answer(int*, int*)'
/usr/bin/ld: cave.cpp:(.text+0x339): undefined reference to `answer(int*, int*)'
/usr/bin/ld: /tmp/ccunrlZ3.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status