Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.148 s | 12 KBi |
#2 |
Correcto
|
0.154 s | 12 KBi |
#3 |
Correcto
|
0.173 s | 12 KBi |
#4 |
Correcto
|
0.178 s | 12 KBi |
#5 |
Correcto
|
0.161 s | 14 KBi |
#6 |
Correcto
|
0.153 s | 12 KBi |
#7 |
Correcto
|
0.159 s | 12 KBi |
#8 |
Correcto
|
0.128 s | 12 KBi |
#9 |
Correcto
|
0.16 s | 12 KBi |
#10 |
Correcto
|
0.167 s | 12 KBi |
#11 |
Incorrecto
|
0.183 s | 12 KBi |
#12 |
Incorrecto
|
0.164 s | 12 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; } }