제출 #46342

#제출 시각아이디문제언어결과실행 시간메모리
46342Noam527동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <string> #include <time.h> #include <stack> #include <queue> #include <random> #include <fstream> #define endl '\n' #define flush fflush(stdout), cout.flush() #define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define debug cout << "ok" << endl #define finish(x) return cout << x << endl, 0 typedef long long ll; typedef long double ldb; const int md = 1e9 + 7, inf = 1e9 + 7; const ll hs = 199; const ldb eps = 1e-9, pi = acos(-1); using namespace std; int tryCombination(int S[]); void answer(int S[], int D[]); void exploreCave(int N); struct tag { int to, correct; tag(int ii = 0) { to = ii; correct = 0; } }; int n, send[5000], solved; vector<tag> a; int check(int first) { for (int i = 0; i < n; i++) if (i < first) send[a[i].to] = a[i].correct; else send[a[i].to] = 1 ^ a[i].correct; return tryCombination(send); } void findnext() { static int lo, hi, mid, nval; lo = solved; hi = n - 1; if (check(solved) == solved) { nval = 1; // find first point where check(k) != solved while (lo < hi) { mid = (lo + hi) / 2; if (check(mid) == solved) lo = mid + 1; else hi = mid; } } else { nval = 0; // find first point where check(k) == solved while (lo < hi) { mid = (lo + hi) / 2; if (check(mid) != solved) lo = mid + 1; else hi = mid; } } swap(a[lo], a[solved]); a[solved].correct = nval; } void exploreCave(int N) { n = N; a.resize(n); for (int i = 0; i < n; i++) a[i] = tag(i); for (solved = 0; solved < n; solved++) findnext(); int S[5000], D[5000]; for (int i = 0; i < n; i++) S[i] = a[i].correct; for (int i = 0; i < n; i++) D[i] = a[i].to; answer(S, D); }

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

/tmp/ccbWpJFr.o: In function `main':
grader.c:(.text.startup+0xc): undefined reference to `exploreCave'
/tmp/cccTTAX6.o: In function `exploreCave(int)':
cave.cpp:(.text+0x292): undefined reference to `answer(int*, int*)'
/tmp/cccTTAX6.o: In function `check(int)':
cave.cpp:(.text+0x45): undefined reference to `tryCombination(int*)'
collect2: error: ld returned 1 exit status