Submission #942495

#TimeUsernameProblemLanguageResultExecution timeMemory
942495artixkrishnaSličice (COCI19_slicice)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int MAX = 100005; int dp[506][506]; template <class X, class Y> bool maximize(X &x, const Y &y) { X eps = 1e-9; if (x + eps < y) { x = y; return 1; } return 0; } template <class X, class Y> bool minimize(X &x, const Y &y) { X eps = 1e-9; if (x > y + eps) { x = y; return 1; } return 0; } int main() { int n, m, k; cin >> n >> m >> k; vector<int> P(n); vector<int> B(m + 1); for (auto &i : P) cin >> i; for (auto &i : B) cin >> i; for (int i = 1; i <= n; i++) { for (int v = 0; v <= k; v++) { for (int pre_v = 0; pre_v <= v; pre_v++) { maximize(dp[i][v], dp[i - 1][pre_v] + b[a[i] + (v - pre_v)]); } } } int ans = 0; for (int i = 1; i <= k; i++) { maximize(ans, dp[n][i]); } cout << ans << endl; }

Compilation message (stderr)

slicice.cpp: In function 'int main()':
slicice.cpp:34:47: error: 'b' was not declared in this scope
   34 |         maximize(dp[i][v], dp[i - 1][pre_v] + b[a[i] + (v - pre_v)]);
      |                                               ^
slicice.cpp:34:49: error: 'a' was not declared in this scope
   34 |         maximize(dp[i][v], dp[i - 1][pre_v] + b[a[i] + (v - pre_v)]);
      |                                                 ^