제출 #944347

#제출 시각아이디문제언어결과실행 시간메모리
944347wii동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int tryCombination(int S[]); void answer(int S[], int D[]); void exploreCave(int N); const int MaxN = 5e3; int S[MaxN], D[MaxN]; int knownD[MaxN], knownS[MaxN], mark[MaxN]; void exploreCave(int N) { vector<int> pos; for (int i = 0; i < N; ++i) pos.push_back(i); function<int(int, int)> setup = [&](int u, int mid) { for (int i = 0; i < N; ++i) S[i] = !knownS[u]; for (int i = 0; i <= mid; ++i) S[i] = knownS[u]; for (int i = 0; i < u; ++i) S[knownD[i]] = knownS[i]; return tryCombination(S); }; function<void(int)> query = [&](int u) { cout << u << ": " << endl; int l = 0, r = N - u - 1; knownS[u] = 0; int p = setup(u, -1); knownS[u] = p == -1 || p > u; while (l <= r) { int mid = (l + r) >> 1; //cout << " -> " << l << " " << r << " = " << mid << endl; int res = setup(u, pos[mid]); if (res == -1 || res > u) r = mid - 1; else l = mid + 1; } ++r; //cout << u << " " << pos[r] << endl; knownD[u] = pos[r]; pos.erase(pos.begin() + r); }; for (int i = 0; i < N; ++i) query(i); for (int i = 0; i < N; ++i) S[knownD[i]] = knownS[i]; for (int i = 0; i < N; ++i) D[knownD[i]] = i; answer(S, D); }

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

/usr/bin/ld: /tmp/cctcc2iK.o: in function `exploreCave(int)':
cave.cpp:(.text+0x544): undefined reference to `answer(int*, int*)'
/usr/bin/ld: /tmp/cctcc2iK.o: in function `std::_Function_handler<int (int, int), exploreCave(int)::{lambda(int, int)#1}>::_M_invoke(std::_Any_data const&, int&&, std::_Any_data const&)':
cave.cpp:(.text+0x18c): undefined reference to `tryCombination(int*)'
/usr/bin/ld: /tmp/cc25Cz4J.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status