Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.172 s | 16 KBi |
#2 |
Correcto
|
0.173 s | 15 KBi |
#3 |
Correcto
|
0.192 s | 12 KBi |
#4 |
Correcto
|
0.17 s | 16 KBi |
#5 |
Correcto
|
0.176 s | 15 KBi |
#6 |
Correcto
|
0.159 s | 16 KBi |
#7 |
Correcto
|
0.189 s | 12 KBi |
#8 |
Correcto
|
0.169 s | 16 KBi |
#9 |
Correcto
|
0.194 s | 12 KBi |
#10 |
Correcto
|
0.197 s | 12 KBi |
#11 |
Correcto
|
0.17 s | 16 KBi |
#12 |
Correcto
|
0.184 s | 16 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Data data = readNumsFromStdin(); for (int i = 0; i < data.totalNumbers - 1; i++) { if (data.numbers[i] > data.numbers[i + 1]) { System.out.println("Desordenado"); return; } } System.out.println("Ordenado"); } private static Data readNumsFromStdin() { Data data = new Data(); Scanner in = new Scanner(System.in); data.totalNumbers = in.nextInt(); data.numbers = new int[data.totalNumbers]; for (int i = 0; i < data.totalNumbers; i++) { data.numbers[i] = in.nextInt(); } return data; } private static class Data { int totalNumbers; int[] numbers; } }