Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#2 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#3 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#4 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#5 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#6 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#7 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#8 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#9 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#10 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#11 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#12 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
||
#13 |
Error de compilación
Main.java:3: error: class MaximoElementoSubArregloPequenio is public, should be declared in a file named MaximoElementoSubArregloPequenio.java public class MaximoElementoSubArregloPequenio { ^ 1 error |
import java.util.Scanner; public class MaximoElementoSubArregloPequenio { 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); } } }