█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 4647

Problema 0xde - Ordenar un arreglo grande

  • Autor: 7yrionLannister
  • Fecha: 2021-08-06 02:34:06 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.127 s 12 KBi
#2
Correcto
0.119 s 12 KBi
#3
Correcto
0.13 s 14 KBi
#4
Correcto
0.13 s 14 KBi
#5
Correcto
0.12 s 14 KBi
#6
Correcto
0.122 s 13 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/openjdk13/bin/java Main
0.481 s 125 KBi
#8
Tiempo límite excedido
1.041 s 21 KBi
#9
Tiempo límite excedido
1.031 s 45 KBi
#10
Tiempo límite excedido
1.013 s 22 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/openjdk13/bin/java Main
0.619 s 125 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/openjdk13/bin/java Main
0.588 s 125 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/openjdk13/bin/java Main
0.649 s 125 KBi
#14
Tiempo límite excedido
1.093 s 23 KBi
#15
Tiempo límite excedido
1.025 s 22 KBi
#16
Tiempo límite excedido
1.008 s 28 KBi
#17
Tiempo límite excedido
1.097 s 25 KBi
#18
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/openjdk13/bin/java Main
0.604 s 125 KBi
#19
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/openjdk13/bin/java Main
0.566 s 125 KBi
#20
Tiempo límite excedido
1.029 s 20 KBi
#21
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/openjdk13/bin/java Main
0.625 s 125 KBi
#22
Tiempo límite excedido
1.096 s 23 KBi
#23
Tiempo límite excedido
1.048 s 26 KBi
#24
Tiempo límite excedido
1.013 s 24 KBi
#25
Tiempo límite excedido
1.077 s 24 KBi
#26
Tiempo límite excedido
1.035 s 24 KBi
#27
Tiempo límite excedido
1.076 s 26 KBi
Puntos totales: 23 / 100

Código

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();
    }
}