Submission #1107844

# Submission time Handle Problem Language Result Execution time Memory
1107844 2024-11-02T07:47:34 Z coolboy19521 Soccer Stadium (IOI23_soccer) C++17
0 / 100
1 ms 336 KB
#include "soccer.h"

using namespace std;

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    bool f = true;
    int c = 0;
    vector<vector<int>> d(N, vector<int>(N));
    if (1 == F[0][0]) {
        d[0][0] = 2;
    }
    if (1 == F[0][N - 1]) {
        d[0][N - 1] = 2;
    }
    if (1 == F[N - 1][0]) {
        d[N - 1][0] = 2;
    }
    if (1 == F[N - 1][N - 1]) {
        d[N - 1][N - 1] = 2;
    }
    for (int i = 0; i < N; i ++) {
        for (int j = 0; j < N; j ++) {
            if (0 < i) {
                d[i][j] = max(d[i][j], d[i - 1][j]);
            }
            if (0 < j) {
                d[i][j] = max(d[i - 1][j], d[i][j]);
            }
            if (i < N - 1) {
                d[i][j] = max(d[i + 1][j], d[i][j]);
            }
            if (j < N - 1) {
                d[i][j] = max(d[i][j + 1], d[i][j]);
            }
        }
        for (int j = N - 1; 0 <= j; j --) {
            if (0 < i) {
                d[i][j] = max(d[i][j], d[i - 1][j]);
            }
            if (0 < j) {
                d[i][j] = max(d[i - 1][j], d[i][j]);
            }
            if (i < N - 1) {
                d[i][j] = max(d[i + 1][j], d[i][j]);
            }
            if (j < N - 1) {
                d[i][j] = max(d[i][j + 1], d[i][j]);
            }
        }
    }
    for (int i = N - 1; 0 <= i; i --) {
        for (int j = 0; j < N; j ++) {
            if (0 < i) {
                d[i][j] = max(d[i][j], d[i - 1][j]);
            }
            if (0 < j) {
                d[i][j] = max(d[i - 1][j], d[i][j]);
            }
            if (i < N - 1) {
                d[i][j] = max(d[i + 1][j], d[i][j]);
            }
            if (j < N - 1) {
                d[i][j] = max(d[i][j + 1], d[i][j]);
            }
        }
        for (int j = N - 1; 0 <= j; j --) {
            if (0 < i) {
                d[i][j] = max(d[i][j], d[i - 1][j]);
            }
            if (0 < j) {
                d[i][j] = max(d[i - 1][j], d[i][j]);
            }
            if (i < N - 1) {
                d[i][j] = max(d[i + 1][j], d[i][j]);
            }
            if (j < N - 1) {
                d[i][j] = max(d[i][j + 1], d[i][j]);
            }
        }
    }
    for (int i = 0; i < N; i ++) {
        for (int j = 0; j < N; j ++) {
            if (F[i][j] == 1) {
                if (0 == d[i][j]) {
                    f = false;
                }
            } else {
                c ++;
            }
        }
    }
    if (f) {
        return c;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 336 KB partial
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB ok
2 Correct 1 ms 336 KB ok
3 Runtime error 1 ms 336 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB ok
2 Correct 1 ms 336 KB ok
3 Incorrect 0 ms 336 KB wrong
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 336 KB partial
2 Correct 1 ms 336 KB ok
3 Correct 1 ms 336 KB ok
4 Incorrect 0 ms 336 KB wrong
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 336 KB partial
2 Correct 1 ms 336 KB ok
3 Correct 1 ms 336 KB ok
4 Runtime error 1 ms 336 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 336 KB partial
2 Correct 1 ms 336 KB ok
3 Correct 1 ms 336 KB ok
4 Runtime error 1 ms 336 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 336 KB partial
2 Correct 1 ms 336 KB ok
3 Correct 1 ms 336 KB ok
4 Runtime error 1 ms 336 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -