이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 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;
}
}
}
}
int dp1[N][N][2][2];
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) {
continue;
}
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) {
d0 = 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... |