Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.12 s | 13 KBi |
#2 |
Correcto
|
0.122 s | 13 KBi |
#3 |
Correcto
|
0.137 s | 13 KBi |
#4 |
Correcto
|
0.119 s | 13 KBi |
#5 |
Correcto
|
0.122 s | 13 KBi |
#6 |
Correcto
|
0.135 s | 13 KBi |
#7 |
Correcto
|
0.136 s | 13 KBi |
#8 |
Correcto
|
0.125 s | 13 KBi |
#9 |
Correcto
|
0.13 s | 14 KBi |
#10 |
Correcto
|
0.143 s | 14 KBi |
#11 |
Correcto
|
0.15 s | 13 KBi |
#12 |
Correcto
|
0.133 s | 13 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n > 0 && n < 1000) { int [] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } boolean sorted = true; for (int i = 0; i + 1 < n; i++) { sorted = sorted && (a[i] <= a[i + 1]); } if (sorted == true) { System.out.println("Ordenado"); } else { System.out.println("Desordenado"); } } else { System.out.println("Number out of range"); } } }