제출 #930428

#제출 시각아이디문제언어결과실행 시간메모리
930428Cutebol선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std ; const int N = 2e7 + 4 ; #define int long long template <class T> bool chmax( T& x , const T& y ){ bool f = 0 ; if ( x < y ) x = y , f = 1 ; return f ; } template <class T> bool chmin( T &x , const T &y ){ bool f = 0 ; if ( x > y ) x = y , f = 1 ; return f ; } int dpl[N] , dpr[N] ; long long delivery(int n, int k, int l, int a[]) { for ( int i = 0 ; i < n ; i ++ ) dpl[i] = (( i >= k ) ? dpl[i-k] : 0) + min(l,2*a[i]) ; for ( int i = n-1 ; i >= 0 ; i -- ) dpr[i] = dpr[i+k] + min(l,2*(l-a[i])) ; int ans = min(dpr[0],dpr[n-1]) ; for ( int i = 0 ; i < n ; i ++ ) chmin ( ans , dpl[i]+dpr[i+1] ) ; return ans ; } /* int a[N] ; signed main(){ int n , k , l ; cin >> n >> k >> l ; for ( int i = 0 ; i < n ; i ++ ) cin >> a[i] ; cout << delivery( n , k , l , a ) ; } //*/

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

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