This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |