Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.087 s | 16 KBi |
#2 |
Correcto
|
0.082 s | 16 KBi |
#3 |
Correcto
|
0.088 s | 17 KBi |
#4 |
Correcto
|
0.128 s | 14 KBi |
#5 |
Correcto
|
0.082 s | 16 KBi |
#6 |
Correcto
|
0.09 s | 16 KBi |
#7 |
Correcto
|
0.078 s | 16 KBi |
#8 |
Correcto
|
0.089 s | 16 KBi |
#9 |
Correcto
|
0.087 s | 16 KBi |
#10 |
Correcto
|
0.085 s | 16 KBi |
#11 |
Correcto
|
0.084 s | 16 KBi |
#12 |
Correcto
|
0.101 s | 17 KBi |
#13 |
Correcto
|
0.088 s | 16 KBi |
#14 |
Correcto
|
0.091 s | 16 KBi |
#15 |
Correcto
|
0.099 s | 16 KBi |
#16 |
Correcto
|
0.095 s | 16 KBi |
#17 |
Correcto
|
0.119 s | 17 KBi |
#18 |
Correcto
|
0.088 s | 16 KBi |
#19 |
Correcto
|
0.091 s | 16 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] array = new int[n]; for(int i=0; i<n; i++){ array[i] = scanner.nextInt(); } int maxArea = Integer.MIN_VALUE; for(int i=0; i<n; i++){ int height = array[i]; int count = 1; for(int j=i+1; j<n; j++){ if(array[j] >= height){ count++; } else { break; } } for(int j=i-1; j>=0; j--){ if(array[j] >= height){ count++; } else { break; } } int area = height * count; if(area > maxArea){ maxArea = area; } } System.out.println(maxArea); } }