제출 #1120334

#제출 시각아이디문제언어결과실행 시간메모리
1120334epicci23선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "boxes.h" using namespace std; #define ll long long #define all(x) x.begin() , x.end() #define sz(x) (ll)x.size() const ll INF = 1e18 + 5; ll delivery(ll N, ll K, ll L, ll p[]) { ll n = N, k = K , l = L; ll ar[n + 5], pre[n + 5], suf[n + 5]; for(ll i = 1 ; i <= n ; i++) ar[i] = p[i - 1]; pre[0] = suf[n + 1] = 0; for(ll i = 1 ; i <= n ; i++) pre[i] = ar[i] * 2 + pre[max(0LL , i - k)]; for(ll i = n ; i >= 1; i--) suf[i] = 2 * (l - ar[i]) + suf[min(n + 1 , i + k)]; ll ans = INF; for(ll i = 0; i <= n ; i++) ans = min(ans, pre[i] + suf[i+1]); return ans; } /*void _(){ ll n,k,l; cin >> n >> k >> l; ll ar[n + 5], pre[n + 5], suf[n + 5]; for(ll i = 1 ; i <= n ; i++) cin >> ar[i]; pre[0] = suf[n + 1] = 0; for(ll i = 1 ; i <= n ; i++) pre[i] = ar[i] * 2 + pre[max(0LL , i - k)]; for(ll i = n ; i >= 1; i--) suf[i] = 2 * (l - ar[i]) + suf[min(n + 1 , i + k)]; ll ans = INF; for(ll i = 0; i <= n ; i++) ans = min(ans, pre[i] + suf[i+1]); cout << ans << '\n'; } int32_t main(){ ios::sync_with_stdio(0);cin.tie(0); ll tc = 1;//cin >> tc; while(tc--) _(); }*/

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

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