Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.121 s | 13 KBi |
#2 |
Incorrecto
|
0.112 s | 13 KBi |
#3 |
Incorrecto
|
0.126 s | 13 KBi |
#4 |
Incorrecto
|
0.124 s | 13 KBi |
#5 |
Incorrecto
|
0.113 s | 13 KBi |
#6 |
Incorrecto
|
0.117 s | 13 KBi |
#7 |
Incorrecto
|
0.119 s | 13 KBi |
#8 |
Incorrecto
|
0.11 s | 13 KBi |
#9 |
Incorrecto
|
0.12 s | 13 KBi |
#10 |
Incorrecto
|
0.108 s | 13 KBi |
#11 |
Incorrecto
|
0.184 s | 14 KBi |
#12 |
Incorrecto
|
0.164 s | 14 KBi |
#13 |
Incorrecto
|
0.18 s | 14 KBi |
#14 |
Incorrecto
|
0.219 s | 16 KBi |
#15 |
Incorrecto
|
0.222 s | 15 KBi |
#16 |
Incorrecto
|
0.191 s | 15 KBi |
#17 |
Incorrecto
|
0.199 s | 22 KBi |
#18 |
Incorrecto
|
0.204 s | 16 KBi |
#19 |
Incorrecto
|
0.235 s | 19 KBi |
#20 |
Incorrecto
|
0.232 s | 18 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++) { System.out.println(entries[i]); } } private static void swap(Integer[] ar, int a, int b) { int temp = ar[a]; ar[a] = ar[b]; ar[b] = temp; } }