제출 #501365

#제출 시각아이디문제언어결과실행 시간메모리
501365kevinxiehkGap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
#ifdef __cplusplus extern "C" { #endif void MinMax(long long s, long long t, long long* mn, long long* mx); long long findGap(int T, int N); #ifdef __cplusplus } #endif // TODO: global variables can be declared here long long max(long long a, long long b) { return (a > b ? a : b); } long long findGap(int T, int n) { // TODO: implementation if(T == 1) { long long arr[n + 5]; for(int i = 0; i < (n + 1) / 2; i++) { if(i == 0) MinMax(0, 1000000000000000000LL, &arr[0], &arr[n - 1]); else MinMax(arr[i - 1] + 1, arr[n - i] - 1, &arr[i], &arr[n - i - 1]); } long long ans = 0; for(int i = 0; i < n - 1; i++) ans = max(ans, arr[i + 1] - arr[i]); return ans; } else { long long l, r; MinMax(0, 1000000000000000000LL, &l, &r); long long chunk = (r - l + n - 2) / (n - 1); long long a, b, c = l; l++; long long ans = 0; while(l < r) { MinMax(l, l + chunk - 1, &a, &b); l += chunk; if(a == -1) continue; ans = max(ans, a - c); c = b; } ans = max(ans, r - c); return ans; } }

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

/usr/bin/ld: /tmp/cc0nFtO4.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
/usr/bin/ld: /tmp/cczov3e1.o: in function `findGap':
gap.cpp:(.text+0xfb): undefined reference to `MinMax'
/usr/bin/ld: gap.cpp:(.text+0x13e): undefined reference to `MinMax'
/usr/bin/ld: gap.cpp:(.text+0x15d): undefined reference to `MinMax'
/usr/bin/ld: gap.cpp:(.text+0x1ac): undefined reference to `MinMax'
collect2: error: ld returned 1 exit status