Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.117 s | 16 KBi |
#2 |
Correcto
|
0.117 s | 34 KBi |
#3 |
Correcto
|
0.13 s | 14 KBi |
#4 |
Correcto
|
0.141 s | 54 KBi |
#5 |
Correcto
|
0.104 s | 16 KBi |
#6 |
Correcto
|
0.107 s | 16 KBi |
#7 |
Correcto
|
0.122 s | 16 KBi |
#8 |
Correcto
|
0.12 s | 17 KBi |
#9 |
Correcto
|
0.153 s | 14 KBi |
#10 |
Correcto
|
0.17 s | 14 KBi |
#11 |
Correcto
|
0.121 s | 16 KBi |
#12 |
Correcto
|
0.149 s | 31 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int arr[] = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } sc.close(); boolean orden = true; for (int i = 0; i < n; i++) { if(i==n-1) { break; } if (arr[i] > arr[i + 1]) { orden = false; } } if (orden==true) { System.out.println("Ordenado"); }else { System.out.println("Desordenado"); } } }