Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.092 s | 16 KBi |
#2 |
Correcto
|
0.105 s | 13 KBi |
#3 |
Correcto
|
0.088 s | 16 KBi |
#4 |
Correcto
|
0.1 s | 16 KBi |
#5 |
Correcto
|
0.084 s | 16 KBi |
#6 |
Correcto
|
0.095 s | 16 KBi |
#7 |
Correcto
|
0.093 s | 16 KBi |
#8 |
Correcto
|
0.099 s | 16 KBi |
#9 |
Correcto
|
0.088 s | 16 KBi |
#10 |
Correcto
|
0.104 s | 16 KBi |
#11 |
Correcto
|
0.091 s | 16 KBi |
#12 |
Correcto
|
0.12 s | 16 KBi |
import java.util.*; public class Main { public static void main(String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] numbers = new int[n]; for(int i= 0; i<n; i++){ numbers[i]=sc.nextInt(); } System.out.println(isOrdered(numbers)); } public static String isOrdered(int [] numbers){ if(numbers.length==1) return "Ordenado"; for(int i=0,j=1; j<numbers.length; i++,j++){ if(numbers[i]>numbers[j]) return "Desordenado"; } return "Ordenado"; } }