Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.066 s | 10 KBi |
#2 |
Correcto
|
0.07 s | 10 KBi |
#3 |
Correcto
|
0.07 s | 12 KBi |
#4 |
Correcto
|
0.067 s | 9 KBi |
#5 |
Correcto
|
0.066 s | 10 KBi |
#6 |
Correcto
|
0.07 s | 10 KBi |
#7 |
Correcto
|
0.076 s | 17 KBi |
#8 |
Correcto
|
0.068 s | 10 KBi |
#9 |
Correcto
|
0.078 s | 18 KBi |
#10 |
Correcto
|
0.072 s | 10 KBi |
#11 |
Correcto
|
0.068 s | 11 KBi |
#12 |
Correcto
|
0.073 s | 10 KBi |
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; class Main{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; Long a, b; st = new StringTokenizer(br.readLine()); String sort = "Ordenado"; String unsort = "Desordenado"; boolean flag = false; int n = Integer.parseInt(st.nextToken()); st = new StringTokenizer(br.readLine()); if (n == 1) { System.out.println(sort); } else { a = Long.parseLong(st.nextToken()); while (st.hasMoreTokens() && !flag) { b = Long.parseLong(st.nextToken()); if (a <= b) { a = b; } else { flag = true; } } System.out.println(flag ? unsort : sort); } } }