Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#2 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#3 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#4 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#5 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#6 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#7 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#8 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#9 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
||
#10 |
Error de compilación
Main.java:40: error: reached end of file while parsing } ^ 1 error |
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); } }