Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.085 s | 16 KBi |
#2 |
Incorrecto
|
0.091 s | 16 KBi |
#3 |
Incorrecto
|
0.086 s | 16 KBi |
#4 |
Incorrecto
|
0.088 s | 16 KBi |
#5 |
Incorrecto
|
0.152 s | 30 KBi |
#6 |
Correcto
|
0.084 s | 16 KBi |
#7 |
Correcto
|
0.088 s | 16 KBi |
#8 |
Correcto
|
0.067 s | 16 KBi |
#9 |
Incorrecto
|
0.1 s | 16 KBi |
#10 |
Incorrecto
|
0.151 s | 54 KBi |
#11 |
Correcto
|
0.096 s | 16 KBi |
#12 |
Correcto
|
0.147 s | 15 KBi |
import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.Arrays; public class Main { public static void main(String[] args) { Scanner line = new Scanner(System.in); Boolean listVerify[]; int lineNumber = 0; int listLengthInputInt = 0; while (line.hasNextLine()) { if (lineNumber == 0) { String listLengthInput = line.nextLine(); listLengthInputInt = Integer.parseInt(listLengthInput); lineNumber++; } else if (listLengthInputInt == 0) { System.out.println("Ordenado"); } else { String[] numbersList = line.nextLine().split("\\s"); listVerify = new Boolean[listLengthInputInt]; for (int i = 0; i < listLengthInputInt - 1; i++) { int firstNumber = Integer.parseInt(numbersList[i]); int secondNumber = Integer.parseInt(numbersList[i++]); listVerify[i] = firstNumber > secondNumber; } if (Arrays.asList(listVerify).contains(true)) { System.out.println("Desordenado"); } else { System.out.println("Ordenado"); } } } line.close(); } }