답안 #89983

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89983 2018-12-19T13:22:20 Z Retro3014 선물상자 (IOI15_boxes) C++17
컴파일 오류
0 ms 0 KB
#include "boxes.h"
#include <algorithm>

using namespace std;

#define MAX_N 10000000
typedef long long ll;

ll costf[MAX_N+1], coste[MAX_N+1];
ll answer;



long long delivery(int N, int K, int L, int p[]) {
	for(int i=0; i<N; i++){
		costf[i]=2*(ll)p[i]+(i<K?0:costf[i-K]);
	}	
	for(int i=N-1; i>=0; i--){
		coste[i]=(L-p[i])*2+(i>=N-K?0:coste[i+K]);
	}
	answer=min(costf[N-1], coste[0]);
	for(int i=0; i<N-1; i++){
		answer=min(answer, costf[i]+coste[i+1]); 
		if(i+K+1<N){
			answer = min(answer, costf[i]+coste[i+K+1]+(ll)L;
		}
	}
    return answer;
}

Compilation message

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:25:52: error: expected ')' before ';' token
    answer = min(answer, costf[i]+coste[i+K+1]+(ll)L;
                                                    ^