Submission #760945

#TimeUsernameProblemLanguageResultExecution timeMemory
760945drdilyorCatfish Farm (IOI22_fish)C++17
Compilation error
0 ms0 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll max_weights( int n, int m, vector<int> x, vector<int> y, vector<int> w) { vector arr(n+1, vector(n+1, 0ll)); for (int i = 0; i < m; i++) arr[x[i]+1][y[i]] += w[i]; auto sum = [&](int c, int l, int r) { // [l, r) ll res = 0; for (int i = l; i < r; i++) res += arr[c][i]; if (l <= r) return res; else return 0ll; }; vector memo(n+1, vector(n+1, vector(n+1, -1ll))); auto dp = [&](auto& dp, int c, int h1, int h2)->ll{ if (c == n+1) return 0; ll& res = memo[c][h1][h2]; if (res!=-1) return res; res = 0; for (int h3 = 0; h3 <= n && h3 <= Y; h3++) { ll val = + sum(c-1, max(h1, h2), h3) + sum(c, h3, h2); res = max(res, val + dp(dp, c+1, h2, h3)); } return res; }; ll res = dp(dp, 1, 0, 0); return res; }

Compilation message (stderr)

fish.cpp: In lambda function:
fish.cpp:26:43: error: 'Y' was not declared in this scope
   26 |         for (int h3 = 0; h3 <= n && h3 <= Y; h3++) {
      |                                           ^