Submission #1247483

#TimeUsernameProblemLanguageResultExecution timeMemory
1247483fskarica메기 농장 (IOI22_fish)C++20
Compilation error
0 ms0 KiB
#include "fish.h"
#include <bits/stdc++.h>

using namespace std;

//#define int long long
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>

const int MAX = 3000010;
int n, m;
vector <int> vx, vy, w;
ll dp[MAX][M5AX][2];
int mat[MAX][5];

ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
    n = N, m = M, vx = X, vy = Y, w = W;

    for (int i = 0; i < m; i++) {
        vx[i]++;
        vy[i]++;

        mat[vx[i]][vy[i]] += w[i];
    }

    for (int i = 2; i <= n; i++) {
        for (int j = 0; j <= 1; j++) dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][1]);
        for (int j = 0; j <= 1; j++) dp[i][j][1] = max(dp[i - 1][j][0], dp[i - 1][j][1]);

        ll maxx = 0;
        for (int j = 1; j >= 0; j--) {
            maxx = max(maxx, max(dp[i - 1][j][0], dp[i - 1][j][1]));

            dp[i][j][0] = max(dp[i][j][0], maxx);

            maxx += mat[i][j];
        }

        maxx = 0;
        for (int j = 0; j <= 1; j++) {
            maxx += mat[i - 1][j];
            maxx = max(maxx, dp[i - 1][j][1]);

            dp[i][j][1] = max(dp[i][j][1], maxx);
        }

        for (int j = 0; j <= 1; j++) dp[i][j][0] = max(dp[i][j][0], dp[i][j][1]);
    }

    ll ret = 0;
    for (int i = 0; i <= n; i++) ret = max(ret, max(dp[n][i][0], dp[n][i][1]));

    return ret;
}

Compilation message (stderr)

fish.cpp:15:12: error: 'M5AX' was not declared in this scope; did you mean 'MAX'?
   15 | ll dp[MAX][M5AX][2];
      |            ^~~~
      |            MAX
fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:29:38: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |         for (int j = 0; j <= 1; j++) dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][1]);
      |                                      ^~
      |                                      dup
fish.cpp:30:38: error: 'dp' was not declared in this scope; did you mean 'dup'?
   30 |         for (int j = 0; j <= 1; j++) dp[i][j][1] = max(dp[i - 1][j][0], dp[i - 1][j][1]);
      |                                      ^~
      |                                      dup
fish.cpp:34:34: error: 'dp' was not declared in this scope; did you mean 'dup'?
   34 |             maxx = max(maxx, max(dp[i - 1][j][0], dp[i - 1][j][1]));
      |                                  ^~
      |                                  dup
fish.cpp:44:30: error: 'dp' was not declared in this scope; did you mean 'dup'?
   44 |             maxx = max(maxx, dp[i - 1][j][1]);
      |                              ^~
      |                              dup
fish.cpp:49:38: error: 'dp' was not declared in this scope; did you mean 'dup'?
   49 |         for (int j = 0; j <= 1; j++) dp[i][j][0] = max(dp[i][j][0], dp[i][j][1]);
      |                                      ^~
      |                                      dup
fish.cpp:53:53: error: 'dp' was not declared in this scope; did you mean 'dup'?
   53 |     for (int i = 0; i <= n; i++) ret = max(ret, max(dp[n][i][0], dp[n][i][1]));
      |                                                     ^~
      |                                                     dup