제출 #389043

#제출 시각아이디문제언어결과실행 시간메모리
389043faresbasbs선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long n,k,l,num,in[10000001],dp1[10000001],dp2[10000001]; int main(){ cin >> n >> k >> l; num = l/2; long long ans = 1000000000000000000 , v1 = 0 , v2 = 0; for(int i = 1 ; i <= n ; i += 1){ cin >> in[i]; if(in[i] <= num){ if(i >= k){ dp1[i] = dp1[i-k]; } dp1[i] += 2*in[i]; v1 = dp1[i]; } } for(int i = n ; i >= 1 ; i -= 1){ if(in[i] <= num){ break; } if(i+k <= n){ dp2[i] = dp2[i+k]; } dp2[i] += 2*(l-in[i]); v2 = dp2[i]; } ans = v1+v2; if(k >= n){ ans = min(ans,l); } for(int i = 1 ; i+k-1 <= n ; i += 1){ if(in[i] <= num && in[i+k-1] > num){ ans = min(ans,dp1[i-1]+l+dp2[i+k]); } } cout << ans << endl; }

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

boxes.cpp: In function 'int main()':
boxes.cpp:19:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   19 |     for(int i = n ; i >= 1 ; i -= 1){
      |                 ^
/tmp/ccqpwYU3.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/cc3wF4TO.o:boxes.cpp:(.text.startup+0x0): first defined here
/tmp/ccqpwYU3.o: In function `main':
grader.c:(.text.startup+0x1cb): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status