Submission #1066439

# Submission time Handle Problem Language Result Execution time Memory
1066439 2024-08-19T21:43:49 Z aaaaaarroz Soccer Stadium (IOI23_soccer) C++17
0 / 100
1 ms 348 KB
#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
1 Partially correct 1 ms 344 KB partial
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB partial
2 Incorrect 0 ms 348 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB partial
2 Incorrect 0 ms 348 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB partial
2 Incorrect 0 ms 348 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB partial
2 Incorrect 0 ms 348 KB wrong
3 Halted 0 ms 0 KB -