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 <bits/stdc++.h>
using namespace std;
int biggest_stadium(int N, vector<vector<int>> F) {
map<tuple<int, int, int>, bool> libre;
for (int fila = 0; fila < N; fila++) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) { // Corrección del índice
if (i == j) {
libre[{fila, i, j}] = !F[fila][j];
} else {
libre[{fila, i, j}] = (!F[fila][j]) && libre[{fila, i, j - 1}];
}
}
}
}
int best = 0;
for (int fila = 0; fila < N; fila++) {
for (int columna = 0; columna < N; columna++) {
for (int i = 0; i <= columna; i++) {
for (int j = columna; j < N; j++) {
if (libre[{fila, i, j}]) {
vector<pair<int, int>> almacen;
almacen.push_back({i, j});
int suma = 0;
int fil = fila;
// Recorrido hacia arriba
while (fil >= 0 && F[fil][columna] == 1) { // Cambio de fila
int l = columna, r = columna;
while (l > almacen.back().first && r < almacen.back().second) {
if (libre[{fil, l - 1, r}]) {
l--;
} else if (libre[{fil, l, r + 1}]) {
r++;
} else {
break;
}
}
almacen.push_back({l, r});
fil--; // Cambio de fila hacia arriba
}
// Recorrido hacia abajo
fil = fila;
while (fil < N && F[fil][columna] == 1) { // Cambio de fila
int l = columna, r = columna;
while (l > almacen.back().first && r < almacen.back().second) {
if (libre[{fil, l - 1, r}]) {
l--;
} else if (libre[{fil, l, r + 1}]) {
r++;
} else {
break;
}
}
almacen.push_back({l, r});
fil++; // Cambio de fila hacia abajo
}
for (auto [x, y] : almacen) {
suma += (y - x + 1);
}
suma -= (j - i + 1);
best = max(suma, best);
}
}
}
}
}
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... |