Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.168 s | 16 KBi |
#2 |
Correcto
|
0.141 s | 16 KBi |
#3 |
Correcto
|
0.176 s | 30 KBi |
#4 |
Correcto
|
0.16 s | 16 KBi |
#5 |
Correcto
|
0.142 s | 15 KBi |
#6 |
Correcto
|
0.149 s | 15 KBi |
#7 |
Correcto
|
0.15 s | 16 KBi |
#8 |
Correcto
|
0.155 s | 15 KBi |
#9 |
Correcto
|
0.17 s | 16 KBi |
#10 |
Correcto
|
0.171 s | 16 KBi |
#11 |
Incorrecto
|
0.197 s | 35 KBi |
#12 |
Incorrecto
|
0.151 s | 16 KBi |
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sn = new Scanner(System.in); int size = Integer.parseInt(sn.nextLine()); String[] arItems = sn.nextLine().split(" "); List<Integer> entries = new ArrayList<>(); for (int i = 0; i < size; i++) { int arItem = Integer.parseInt(arItems[i]); entries.add(arItem); } String respuesta = ordernar(size, entries) ? "Ordenado" : "Desordenado"; System.out.println(respuesta); } private static boolean ordernar(int size, List<Integer> list) { int min = 0; boolean isOrdered = false; for(int i : list) { if(i<min) return false; min = i; } return true; } }