제출 #531105

#제출 시각아이디문제언어결과실행 시간메모리
531105sliviu선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <boxes.h> using namespace std; using ll = long long; int delivery(int n, int k, int l, int a[]) { ll ans = INT_MAX; vector<ll> dpl(n + 2), dpr(n + 2); for (int i = 1; i <= n; ++i) dpl[i] = dpl[max(i - k, 0)] + 2 * a[i - 1]; for (int i = n; i; --i) dpr[i] = dpr[min(i + k, n + 1)] + 2 * (l - a[i - 1]); for (int i = 1; i <= n; ++i) ans = min({ans, dpl[i] + dpr[i + 1], dpl[i] + dpr[min(n + 1,i + k + 1)] + l}); return ans; }

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

boxes.cpp:7:5: error: ambiguating new declaration of 'int delivery(int, int, int, int*)'
    7 | int delivery(int n, int k, int l, int a[]) {
      |     ^~~~~~~~
In file included from boxes.cpp:2:
boxes.h:4:11: note: old declaration 'long long int delivery(int, int, int, int*)'
    4 | long long delivery(int N, int K, int L, int p[]);
      |           ^~~~~~~~
boxes.cpp: In function 'int delivery(int, int, int, int*)':
boxes.cpp:16:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   16 |  return ans;
      |         ^~~