Submission #1216920

#TimeUsernameProblemLanguageResultExecution timeMemory
1216920takoshanavaBoxes with souvenirs (IOI15_boxes)C++20
Compilation error
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; const int INF = 1e9; int delivery(int N, int K, int L, int pos[]) { auto cw = [&](int a, int b){ return (b - a + L) % L; }; auto ccw = [&](int a, int b){ return (a - b + L) % L; }; sort(pos, pos + N, [&](int a, int b) { return cw(0, a) < cw(0, b); }); vector<vector<int>> cost(N, vector<int>(N, INF)); for (int i = 0; i < N; i++) { int far1 = 0, far2 = 0; for (int j = i; j < N && j - i + 1 <= K; j++) { far1 = max(far1, cw(0, pos[j])); cost[i][j] = min(cost[i][j], 2 * far1); far2 = max(far2, ccw(0, pos[j])); cost[i][j] = min(cost[i][j], 2 * far2); if (j - i + 1 == K) { cost[i][j] = min(cost[i][j], L); } } } vector<int> dp(N+1, INF); dp[0] = 0; for (int i = 1; i <= N; i++) { for (int j = max(0, i - K); j < i; j++) { dp[i] = min(dp[i], dp[j] + cost[j][i-1]); } } return dp[N]; }

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 pos[]) {
      |     ^~~~~~~~
In file included from boxes.cpp:1:
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[]);
      |           ^~~~~~~~