Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.096 s | 16 KBi |
#2 |
Correcto
|
0.093 s | 17 KBi |
#3 |
Correcto
|
0.138 s | 18 KBi |
#4 |
Correcto
|
0.097 s | 17 KBi |
#5 |
Correcto
|
0.109 s | 17 KBi |
#6 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.514 s | 125 KBi |
#7 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.481 s | 125 KBi |
#8 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.516 s | 125 KBi |
#9 |
Tiempo límite excedido
|
1.037 s | 98 KBi |
#10 |
Tiempo límite excedido
|
1.098 s | 125 KBi |
import java.util.HashMap; import java.util.Scanner; public class Main { private static HashMap<Integer, Integer> memoization = new HashMap<Integer, Integer>(); public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int casosDePrueba = scanner.nextInt(); for(int caso=1; caso<=casosDePrueba; caso++){ int n = scanner.nextInt(); int[] array = new int[n]; for(int i=0; i<n; i++){ array[i]=scanner.nextInt(); } //findMaxSuffixArray(0, array); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Case #" + caso +":"); for(int i=0; i<n; i++){ int value = array[i]; for (int j=i+1; j<=n; j++){ if(j == n){ stringBuilder.append(" -1"); } else { int horizon = array[j]; if(horizon > value){ stringBuilder.append(" " +horizon); break; } } } } System.out.println(stringBuilder); } } }