제출 #1009728

#제출 시각아이디문제언어결과실행 시간메모리
1009728ProtonDecay314선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
/* ??? */ #include<bits/stdc++.h> // #define DEBUG using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pi> vpi; typedef vector<pll> vpll; #define first fi; #define second se; ll delivery(int intn, int intk, int intl, vi pos_int) { ll n = intn, k = intk, l = intl; vll pos(n, 0ll); for(ll i = 0; i < n; i++) { pos[i] = pos_int[i]; } ll ans = 0ll; if(k == 1) { for(ll i = 0; i < n; i++) { ans += min(pos[i], l - pos[i]) << 1ll; } } else if(k == n) { sort(pos.begin(), pos.end()); ll min_not_zero = -1ll; for(ll i = 0; i < n; i++) { if(pos[i] != 0ll) { min_not_zero = pos[i]; break; } } bool gthalfexists = pos[n - 1ll] > (l >> 1ll); bool lthalfexists = (min_not_zero != -1ll) && (min_not_zero <= (l >> 1ll)); if(gthalfexists && lthalfexists) { ans = l; } else if(gthalfexists) { ans = (l - min_not_zero) << 1ll; } else { ans = pos[n - 1] << 1ll; } } return ans; } #ifdef DEBUG int main() { cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false); ll n, k, l; cin >> n >> k >> l; vll positions(n, 0); for(ll& pos : positions) { cin >> pos; } cout << delivery(n, k, l, positions) << endl; } #endif

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

/usr/bin/ld: /tmp/ccC5wA6t.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status