Submission #531105

#TimeUsernameProblemLanguageResultExecution timeMemory
531105sliviuBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
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; }

Compilation message (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;
      |         ^~~