Submission #990088

# Submission time Handle Problem Language Result Execution time Memory
990088 2024-05-29T14:17:35 Z haiphong5g0 Boxes with souvenirs (IOI15_boxes) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define task "CAU5"
#define pl pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b, c) for (ll i=a; i<=b; i+=c)
#define FORE(i, a, b, c) for (ll i=a; i>=b; i+=c)
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll Mod = 998244353;
const int maxn = 1e7;
const ll Inf = 1e16;
ll delivery(ll n, ll k, ll l, ll A[])
{
    ll L[maxn+1], R[maxn+1], ans = Inf;
    FOR(i, 1, n, 1) {
        ll ans = Inf;
        L[i] = (i >= k ? L[i-k] : 0) + A[i-1]*2;
        R[i] = (i >= k ? R[i-k] : 0) + (l - A[n-i])*2;
    }
    FOR(i, 0, n, 1) ans = min(ans, L[i] + R[n-i]);
    FOR(i, 0, n-k, 1) ans = min(ans, L[i] + R[n-i-k] + k);
    return ans;
}
/*int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(nullptr); cout.tie(nullptr);
    int t; ///Setup();
    for (t=1; t--;)
    {
        ///Read();
        cout << delivery(n, k, l, A);
    }
}*/

Compilation message

boxes.cpp: In function 'll delivery(ll, ll, ll, ll*)':
boxes.cpp:20:12: warning: declaration of 'ans' shadows a previous local [-Wshadow]
   20 |         ll ans = Inf;
      |            ^~~
boxes.cpp:18:30: note: shadowed declaration is here
   18 |     ll L[maxn+1], R[maxn+1], ans = Inf;
      |                              ^~~
boxes.cpp:20:12: warning: unused variable 'ans' [-Wunused-variable]
   20 |         ll ans = Inf;
      |            ^~~
/usr/bin/ld: /tmp/ccNffM4l.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status