Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.079 s | 10 KBi |
#2 |
Correcto
|
0.042 s | 13 KBi |
#3 |
Correcto
|
0.042 s | 14 KBi |
#4 |
Incorrecto
|
0.089 s | 10 KBi |
#5 |
Incorrecto
|
0.056 s | 14 KBi |
#6 |
Incorrecto
|
0.057 s | 14 KBi |
#7 |
Correcto
|
0.051 s | 14 KBi |
#8 |
Incorrecto
|
0.054 s | 14 KBi |
#9 |
Incorrecto
|
0.084 s | 11 KBi |
#10 |
Incorrecto
|
0.159 s | 12 KBi |
#11 |
Incorrecto
|
0.202 s | 32 KBi |
#12 |
Incorrecto
|
0.497 s | 38 KBi |
#13 |
Tiempo límite excedido
|
1.009 s | 41 KBi |
import java.io.*; import java.util.StringTokenizer; import java.util.*; class Main { public static void main(String[] args) throws IOException{ List<Integer> arr = new ArrayList<Integer>(); List<Integer> res = new ArrayList<Integer>(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; st = new StringTokenizer(br.readLine()); st = new StringTokenizer(br.readLine()); while(st.hasMoreTokens()){ arr.add(Integer.parseInt(st.nextToken())); } st = new StringTokenizer(br.readLine()); int x = 0; int mayor = Integer.MIN_VALUE; int pruebas = Integer.parseInt(st.nextToken()); while(x<pruebas){ st = new StringTokenizer(br.readLine()); int l = Integer.parseInt(st.nextToken()); int clave = l; int r = Integer.parseInt(st.nextToken()); if(l==r){ res.add(l); }else{ List<Integer> datos = new ArrayList<Integer>(); while(l<=r){ datos.add(arr.get(l)); for(int i=0;i<datos.size();i++){ if(datos.get(i)>mayor){ mayor=datos.get(i); } } l++; } res.add((datos.indexOf(mayor))+clave); } x++; } for(int i : res){ System.out.println(i); } } }