Submission #963355

# Submission time Handle Problem Language Result Execution time Memory
963355 2024-04-14T21:27:33 Z tutis Soccer Stadium (IOI23_soccer) C++17
0 / 100
4500 ms 604 KB
#include "soccer.h"

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int biggest_stadium(int N, std::vector<std::vector<int>> C) {
    int dp[N][N][2][2];
    int dp1[N][N][2][2];
    int best = 0;
    for (int y0 = 0; y0 < N; y0++) {
        for (int y1 = y0; y1 < N; y1++) {
            for (int t0: {0, 1}) {
                for (int t1: {0, 1}) {
                    dp[y0][y1][t0][t1] = 0;
                    dp1[y0][y1][t0][t1] = 0;
                }
            }
        }
    }
    for (int x = 0; x < N; x++) {
        for (int y0 = 0; y0 < N; y0++) {
            for (int y1 = y0; y1 < N; y1++) {
                if (C[x][y1] == 1) {
                    break;
                }
                for (int t0: {0, 1}) {
                    for (int t1: {0, 1}) {
                        for (int z0 = 0; z0 < N; z0++) {
                            for (int z1 = z0; z1 < N; z1++) {
                                if (max(z0, y0) > min(z1, y1)) {
                                    continue;
                                }
                                int d0 = t0;
                                int d1 = t1;
                                if (d0 == 1 && y0 > z0) {
                                    continue;
                                }
                                if (y0 < z0) {
                                    d0 = 1;
                                }
                                if (d1 == 1 && y1 < z1) {
                                    continue;
                                }
                                if (y1 > z1) {
                                    d1 = 1;
                                }
                                dp1[y0][y1][d0][d1] = max(dp1[y0][y1][d0][d1],
                                                          dp[z0][z1][t0][t1] + y1 - y0 + 1);
                            }
                        }
                    }
                }
            }
        }
        for (int y0 = 0; y0 < N; y0++) {
            for (int y1 = y0; y1 < N; y1++) {
                for (int t0: {0, 1}) {
                    for (int t1: {0, 1}) {
                        best = max(best, dp1[y0][y1][t0][t1]);
                        dp[y0][y1][t0][t1] = dp1[y0][y1][t0][t1];
                        dp1[y0][y1][t0][t1] = 0;
                    }
                }
            }
        }
    }

    return best;
}
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 600 KB ok
6 Partially correct 1 ms 600 KB partial
7 Execution timed out 4552 ms 604 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 348 KB ok
4 Incorrect 0 ms 348 KB wrong
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Incorrect 0 ms 348 KB wrong
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 600 KB ok
7 Partially correct 1 ms 600 KB partial
8 Execution timed out 4552 ms 604 KB Time limit exceeded
9 Halted 0 ms 0 KB -