Submission #417851

#TimeUsernameProblemLanguageResultExecution timeMemory
417851Kevin_Zhang_TWThe short shank; Redemption (BOI21_prison)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pb emplace_back #define AI(i) begin(i), end(i) template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); } template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); } #ifdef KEV #define DE(args...) kout("[ " + string(#args) + " ] = ", args) void kout() { cerr << endl; } template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); } template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l)==r], ++l; } #else #define DE(...) 0 #define debug(...) 0 #endif const int MAX_N = 4005, inf = 1e9; int dp[MAX_N][MAX_N]; int n, D, T; // i can activate [i, nxt[i]) int s[MAX_N], nxt[MAX_N]; void solve_dp(int cost) { vector<int> ok(n + 10); for (int i = n;i >= 1;--i) { for (int j = i;j < nxt[i];++j) ok[j] = true; dp[i][1] = accumulate(begin(ok)+i, end(ok), 0); for (int j = 2;j <= n;++j) { dp[i][j] = inf; int sum = 0; for (int k = i+1;k <= n;++k) { sum += ok[k-1]; chmin(dp[i][j], sum + dp[k][j-1]); } } } } int32_t main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> n >> D >> T; ++D; // Just to be faster assert(n < MAX_N); for (int i = 1;i <= n;++i) { cin >> s[i]; nxt[i] = min(n+1, max(i, i + T - s[i] + 1)); } solve_dp(); cout << dp[1][D] << '\n'; }

Compilation message (stderr)

prison.cpp: In function 'int32_t main()':
prison.cpp:55:11: error: too few arguments to function 'void solve_dp(int)'
   55 |  solve_dp();
      |           ^
prison.cpp:26:6: note: declared here
   26 | void solve_dp(int cost) {
      |      ^~~~~~~~