Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.116 s | 13 KBi |
#2 |
Correcto
|
0.139 s | 13 KBi |
#3 |
Correcto
|
0.139 s | 13 KBi |
#4 |
Correcto
|
0.122 s | 13 KBi |
#5 |
Correcto
|
0.123 s | 13 KBi |
#6 |
Correcto
|
0.132 s | 13 KBi |
#7 |
Correcto
|
0.122 s | 13 KBi |
#8 |
Correcto
|
0.139 s | 13 KBi |
#9 |
Correcto
|
0.114 s | 13 KBi |
#10 |
Correcto
|
0.141 s | 13 KBi |
#11 |
Correcto
|
0.203 s | 14 KBi |
#12 |
Correcto
|
0.214 s | 14 KBi |
#13 |
Correcto
|
0.212 s | 14 KBi |
#14 |
Correcto
|
0.22 s | 16 KBi |
#15 |
Correcto
|
0.222 s | 16 KBi |
#16 |
Correcto
|
0.215 s | 15 KBi |
#17 |
Correcto
|
0.222 s | 21 KBi |
#18 |
Correcto
|
0.223 s | 16 KBi |
#19 |
Correcto
|
0.232 s | 19 KBi |
#20 |
Correcto
|
0.223 s | 19 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sn = new Scanner(System.in); int size = Integer.parseInt(sn.nextLine()); String[] arItems = sn.nextLine().split(" "); Integer[] entries = new Integer[size]; for (int i = 0; i < size; i++) { int arItem = Integer.parseInt(arItems[i]); entries[i] = arItem; } //Selection sort for (int i = 0; i < size; i++) { for (int j = i; j < size; j++) { if (entries[j] < entries[i]) swap(entries, i, j); } } for (int i = 0; i < size; i++) { if (i > 0) System.out.print(" "); System.out.print(entries[i]); } } private static void swap(Integer[] ar, int a, int b) { int temp = ar[a]; ar[a] = ar[b]; ar[b] = temp; } }