Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.11 s | 13 KBi |
#2 |
Correcto
|
0.111 s | 14 KBi |
#3 |
Correcto
|
0.126 s | 14 KBi |
#4 |
Correcto
|
0.106 s | 13 KBi |
#5 |
Correcto
|
0.139 s | 13 KBi |
#6 |
Correcto
|
0.121 s | 12 KBi |
#7 |
Correcto
|
0.117 s | 13 KBi |
#8 |
Correcto
|
0.126 s | 13 KBi |
#9 |
Correcto
|
0.117 s | 13 KBi |
#10 |
Correcto
|
0.119 s | 13 KBi |
#11 |
Correcto
|
0.183 s | 15 KBi |
#12 |
Correcto
|
0.144 s | 14 KBi |
#13 |
Correcto
|
0.166 s | 14 KBi |
#14 |
Correcto
|
0.156 s | 19 KBi |
#15 |
Correcto
|
0.15 s | 20 KBi |
#16 |
Correcto
|
0.141 s | 15 KBi |
#17 |
Correcto
|
0.167 s | 14 KBi |
#18 |
Correcto
|
0.158 s | 23 KBi |
#19 |
Correcto
|
0.17 s | 19 KBi |
#20 |
Correcto
|
0.175 s | 18 KBi |
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int N = Integer.parseInt(br.readLine()); String[] numsS = br.readLine().split(" "); int[] nums = new int[N]; for (int i = 0; i < N; i++) { nums[i] = Integer.parseInt(numsS[i]); } for (int i = 0; i < N; i++) { int curr = nums[i]; int j = i; while (j > 0 && nums[j - 1] > curr) { nums[j] = nums[j - 1]; j--; } nums[j] = curr; } String array = ""; for (int i = 0; i < N; i++) { array += " " + nums[i]; } bw.write(array.trim() + "\n"); bw.close(); br.close(); } }