█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 5879

Problema 0x4f - Rectángulo de máxima área dentro de un histograma pequeño

  • Autor: slash
  • Fecha: 2022-03-20 19:57:12 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#2
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#3
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#4
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#5
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#6
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#7
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#8
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#9
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#10
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#11
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#12
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#13
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#14
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#15
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#16
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#17
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#18
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
#19
Error de compilación
                      main.cpp:45:19: error: expected ';' after expression
int main(){tests()}
                  ^
                  ;
1 error generated.

                    
Puntos totales: 0 / 100

Código

//
// Created by .slash on 3/20/2022.
//
#include <bits/stdc++.h>

#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define float_equals(a, b) (abs((a)-(b)) < 1e-9)
#define float_equals(a, b) (abs((a)-(b)) < 1e-9)
#define minus_infinite_int (1 << (31))
#define infinite_int (-(minus_infinite_int+1))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef long long ll;
typedef vector<int> vi;

void tests(){
    int max_area = 0, n ; cin>>n;
    vector<int> buildings = vector<int> (n);
    for (int i = 0; i < n; i++){
        cin>>buildings[i];
    }

    for (int i = 0; i < n; i++){
        for(int j = i; j < n; j++){
            int min_h = infinite_int;
            for (int k = i; k <= j; k++){
                if (buildings [k] < min_h) min_h = buildings[k];
            }
            if (min_h * ((j - i) + 1) > max_area) max_area = min_h * ((j - i) + 1);
        }
    }

    cout<<max_area;


}

int main(){tests()}