Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.131 s | 12 KBi |
#2 |
Correcto
|
0.17 s | 12 KBi |
#3 |
Correcto
|
0.172 s | 12 KBi |
#4 |
Correcto
|
0.171 s | 12 KBi |
#5 |
Correcto
|
0.138 s | 12 KBi |
#6 |
Correcto
|
0.128 s | 12 KBi |
#7 |
Correcto
|
0.132 s | 16 KBi |
#8 |
Correcto
|
0.144 s | 16 KBi |
#9 |
Correcto
|
0.147 s | 12 KBi |
#10 |
Correcto
|
0.18 s | 12 KBi |
#11 |
Correcto
|
0.147 s | 12 KBi |
#12 |
Correcto
|
0.199 s | 13 KBi |
import java.util.Scanner; class Main { public static long[] processLine(int N, String line) { long elements[] = new long[N]; String strElements[] = line.split(" "); for (int i=0; i < N; i++) { elements[i] = Long.parseLong(strElements[i]); } return elements; } public static String ascendingOrder(int N, long[] elements) { for (int i=1; i < N; i++) { if (elements[i-1] > elements[i]) return "Desordenado"; } return "Ordenado"; } public static void main(String ...args) { int N; String line; long[] elements; Scanner myObj = new Scanner(System.in); N = Integer.parseInt(myObj.nextLine().trim()); line = myObj.nextLine(); elements = processLine(N, line); System.out.println(ascendingOrder(N, elements)); } }