Submission #1011867

# Submission time Handle Problem Language Result Execution time Memory
1011867 2024-07-01T10:02:47 Z mdn2002 Soccer Stadium (IOI23_soccer) C++17
0 / 100
0 ms 348 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));

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

        return 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);
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Incorrect 0 ms 348 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Incorrect 0 ms 348 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Incorrect 0 ms 348 KB wrong
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Incorrect 0 ms 348 KB wrong
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Incorrect 0 ms 348 KB wrong
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Incorrect 0 ms 348 KB wrong
4 Halted 0 ms 0 KB -