Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.07 s | 15 KBi |
#2 |
Correcto
|
0.134 s | 11 KBi |
#3 |
Correcto
|
0.069 s | 14 KBi |
#4 |
Correcto
|
0.133 s | 11 KBi |
#5 |
Correcto
|
0.064 s | 14 KBi |
#6 |
Correcto
|
0.067 s | 15 KBi |
#7 |
Correcto
|
0.074 s | 15 KBi |
#8 |
Correcto
|
0.129 s | 41 KBi |
#9 |
Correcto
|
0.07 s | 14 KBi |
#10 |
Correcto
|
0.069 s | 14 KBi |
#11 |
Correcto
|
0.112 s | 17 KBi |
#12 |
Correcto
|
0.109 s | 16 KBi |
#13 |
Correcto
|
0.201 s | 12 KBi |
#14 |
Correcto
|
0.187 s | 23 KBi |
#15 |
Correcto
|
0.105 s | 16 KBi |
#16 |
Correcto
|
0.091 s | 15 KBi |
#17 |
Correcto
|
0.232 s | 12 KBi |
#18 |
Correcto
|
0.195 s | 12 KBi |
#19 |
Correcto
|
0.232 s | 12 KBi |
#20 |
Correcto
|
0.1 s | 16 KBi |
import java.io.*; import java.util.*; class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int matriz[] = new int[n]; int x = 0; st = new StringTokenizer(br.readLine()); while(st.hasMoreTokens() && x<n){ matriz[x]=Integer.parseInt(st.nextToken()); x++; } for(int i=1;i<n;i++){ int key = matriz[i]; int evaluar = i-1; while(evaluar >= 0 && matriz[evaluar]>key){ matriz[evaluar+1] = matriz[evaluar]; evaluar--; } matriz[evaluar+1]=key; } for(int i=0;i<n;i++){ System.out.print(matriz[i]+" "); } } }