제출 #445137

#제출 시각아이디문제언어결과실행 시간메모리
445137fuad27선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include<iostream>;using namespace std;typedef long long L;L delivery(int n,int k,int l,int p[]){L pref[n],suf[n];for(L i=0;i<n;i++){if(i>=k)pref[i]=pref[i-k]+min(p[i]*2,l);else pref[i]=min(p[i]*2,l);L j=n-i-1;if(n-j-1>=k)suf[j]=min(l,2*(l-p[j]))+suf[j+k];else suf[j]=min(l,2*(l-p[j]));}L ans=min(suf[0],pref[n-1]);for(L i=1;i<n;i++)ans=min(ans,pref[i-1]+suf[i]);return ans;}

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

boxes.cpp:1:19: warning: extra tokens at end of #include directive
    1 | #include<iostream>;using namespace std;typedef long long L;L delivery(int n,int k,int l,int p[]){L pref[n],suf[n];for(L i=0;i<n;i++){if(i>=k)pref[i]=pref[i-k]+min(p[i]*2,l);else pref[i]=min(p[i]*2,l);L j=n-i-1;if(n-j-1>=k)suf[j]=min(l,2*(l-p[j]))+suf[j+k];else suf[j]=min(l,2*(l-p[j]));}L ans=min(suf[0],pref[n-1]);for(L i=1;i<n;i++)ans=min(ans,pref[i-1]+suf[i]);return ans;}
      |                   ^
/usr/bin/ld: /tmp/cct15o1l.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status