Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.087 s | 16 KBi |
#2 |
Correcto
|
0.092 s | 16 KBi |
#3 |
Correcto
|
0.081 s | 16 KBi |
#4 |
Correcto
|
0.121 s | 16 KBi |
#5 |
Correcto
|
0.116 s | 17 KBi |
#6 |
Correcto
|
0.112 s | 16 KBi |
#7 |
Correcto
|
0.146 s | 18 KBi |
#8 |
Correcto
|
0.097 s | 17 KBi |
#9 |
Correcto
|
0.101 s | 16 KBi |
#10 |
Correcto
|
0.171 s | 22 KBi |
#11 |
Correcto
|
0.5 s | 83 KBi |
#12 |
Correcto
|
0.487 s | 86 KBi |
#13 |
Correcto
|
0.585 s | 86 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[] edificios = new int[n]; for (int i=0; i<n; i++){ edificios[i] = scanner.nextInt(); } int c = scanner.nextInt(); for(int i=0; i<c; i++){ int l = scanner.nextInt(); int r = scanner.nextInt(); int max = Integer.MIN_VALUE; int maxIndex = -1; do{ if(max < edificios[l]){ max = edificios[l]; maxIndex = l; } l++; }while(l<=r); System.out.println(maxIndex); } } }