Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.149 s | 14 KBi |
#2 |
Correcto
|
0.139 s | 14 KBi |
#3 |
Correcto
|
0.151 s | 14 KBi |
#4 |
Correcto
|
0.144 s | 13 KBi |
#5 |
Correcto
|
0.149 s | 14 KBi |
#6 |
Correcto
|
0.158 s | 14 KBi |
#7 |
Correcto
|
0.172 s | 13 KBi |
#8 |
Correcto
|
0.148 s | 14 KBi |
#9 |
Correcto
|
0.15 s | 14 KBi |
#10 |
Correcto
|
0.157 s | 25 KBi |
#11 |
Correcto
|
0.329 s | 18 KBi |
#12 |
Correcto
|
0.312 s | 17 KBi |
#13 |
Correcto
|
0.278 s | 18 KBi |
#14 |
Correcto
|
0.263 s | 18 KBi |
#15 |
Correcto
|
0.274 s | 16 KBi |
#16 |
Correcto
|
0.27 s | 18 KBi |
#17 |
Correcto
|
0.297 s | 19 KBi |
#18 |
Correcto
|
0.281 s | 17 KBi |
#19 |
Correcto
|
0.28 s | 17 KBi |
#20 |
Correcto
|
0.291 s | 17 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int N = sc.nextInt(); int numberArray[] = new int[N]; for(int i = 0; i < N; i++) { numberArray[i] = sc.nextInt(); } sc.close(); // Insertion sort for (int i = 1; i < N; ++i) { int key = numberArray[i]; int j = i - 1; while (j >= 0 && numberArray[j] > key) { numberArray[j + 1] = numberArray[j]; j = j - 1; } numberArray[j + 1] = key; } for(int i = 0; i < numberArray.length; i++) { System.out.print(numberArray[i] + " "); } } }