Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.151 s | 15 KBi |
#2 |
Incorrecto
|
0.159 s | 13 KBi |
#3 |
Incorrecto
|
0.157 s | 18 KBi |
#4 |
Incorrecto
|
0.175 s | 14 KBi |
#5 |
Incorrecto
|
0.161 s | 24 KBi |
#6 |
Tiempo límite excedido
|
0.85 s | 96 KBi |
#7 |
Tiempo límite excedido
|
1.048 s | 108 KBi |
#8 |
Tiempo límite excedido
|
1.08 s | 98 KBi |
#9 |
Tiempo límite excedido
|
0.99 s | 106 KBi |
#10 |
Tiempo límite excedido
|
1.111 s | 98 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(); int accountPay = 1; // 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++) { accountPay++; if (arrayHigh[i] < arrayHigh[j]) { answer = arrayHigh[j]; break; } } System.out.print(" " + answer); } System.out.println(); System.out.println("Pay:" + accountPay); } } catch (Exception e) { System.out.println(e); } } }