Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.179 s | 14 KBi |
#2 |
Correcto
|
0.18 s | 14 KBi |
#3 |
Correcto
|
0.179 s | 13 KBi |
#4 |
Correcto
|
0.174 s | 14 KBi |
#5 |
Correcto
|
0.153 s | 13 KBi |
#6 |
Tiempo límite excedido
|
1.075 s | 113 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.967 s | 125 KBi |
#8 |
Tiempo límite excedido
|
1.02 s | 97 KBi |
#9 |
Tiempo límite excedido
|
1.039 s | 101 KBi |
#10 |
Tiempo límite excedido
|
1.107 s | 97 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { try { Scanner input = new Scanner(System.in); int c = input.nextInt(); // o(n^2) for (int caseNumber = 1; caseNumber <= c; caseNumber++) { System.out.print("Case #" + caseNumber + ":"); int n = input.nextInt(); int[] arrayHigh = new int[n]; for (int buildingNumber = 0; buildingNumber < n; buildingNumber++) { arrayHigh[buildingNumber] = input.nextInt(); } for (int i = 0; i < n; i++) { int answer = -1; for (int j = i+1; j < n; j++) { if (arrayHigh[i] < arrayHigh[j]) { answer = arrayHigh[j]; break; } } System.out.print(" " + answer); } System.out.println(); } } catch (Exception e) { System.out.println(e); } } }