Submission #1011898

# Submission time Handle Problem Language Result Execution time Memory
1011898 2024-07-01T10:48:42 Z mdn2002 Soccer Stadium (IOI23_soccer) C++17
Compilation error
0 ms 0 KB
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
int biggest_stadium(int N, vector<vector<int>> F) {
    int n = N;
    vector<vector<int>> a = F, next(n, vector<int>(n));
    vector dp(n + 1, vector(n + 1, vector<int>(n + 1, -1))));

    function<int(int, int, int, int)> f = [&] (int l, int r, int x, int y) {
        int ans = 0;
        if (dp[l][x][y] != -1) return dp[l][x][y];
        if (x - 1 >= 0) {
            for (int j = l; j <= r; j ++) {
                if (a[x - 1][j]) continue;
                int z = min(r, next[x - 1][j]);
                ans = max(ans, f(j, z, x - 1, y) + z - j + 1);
                j = z;
            }
        }
        if (y + 1 < n) {
            for (int j = l; j <= r; j ++) {
                if (a[y + 1][j]) continue;
                int z = min(r, next[y + 1][j]);
                ans = max(ans, f(j, z, x, y + 1) + z - j + 1);
                j = z;
            }
        }

        return dp[l][x][y] = ans;
    };

    for (int i = 0; i < n; i ++) {
        if (a[i][n - 1] == 0) next[i][n - 1] = n - 1;
        else next[i][n - 1] = n - 2;
        for (int j = n - 2; j >= 0; j --) {
            if (a[i][j]) next[i][j] = j - 1;
            else next[i][j] = next[i][j + 1];
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i ++) {
        for (int j = 0; j < n; j ++) {
            if (a[i][j]) continue;
            ans = max(ans, f(j, next[i][j], i, i) + next[i][j] - j + 1);
            j = next[i][j];
        }
    }
    return ans;
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:7:60: error: expected ',' or ';' before ')' token
    7 |     vector dp(n + 1, vector(n + 1, vector<int>(n + 1, -1))));
      |                                                            ^