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

Envío 2366

Problema 0xde - Ordenar un arreglo grande

  • Autor: javierandresgp
  • Fecha: 2020-12-14 20:50:31 UTC (Hace alrededor de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#2
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#3
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#4
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#5
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#6
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#7
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#8
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#9
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#10
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#11
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#12
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#13
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#14
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#15
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#16
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#17
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#18
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#19
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#20
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#21
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#22
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#23
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#24
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#25
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#26
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
#27
Error de compilación
                      Main.java:26: error: cannot find symbol
      sort(arr, left, start -1);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
Main.java:27: error: cannot find symbol
      sort(arr, start +1, right);
      ^
  symbol:   method sort(int[],int,int)
  location: class Main
2 errors

                    
Puntos totales: 0 / 100

Código

import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args){
    Scanner input = new Scanner(System.in);
    int n = Integer.parseInt(input.nextLine());
    String nn = input.nextLine();
    input.close();
    String arr[] = nn.split(" ");
    int numbers[] = new int[n];
    for (int i = 0; i < n; i++){
      numbers[i] = Integer.parseInt(arr[i]);
    }
    my_sort(numbers, 0, n -1);
    String result = Arrays.toString(numbers);
    result = result.toString();
    result = result.replace(",", " ");
    result = result.replace("[", "");
    result = result.replace("]", "");
    System.out.println(result);
  }
  public static void my_sort(int arr[], int left, int right){
    if (left < right){
      int start = section_sort(arr, left, right);
      sort(arr, left, start -1);
      sort(arr, start +1, right);
    }
  }
  public static int section_sort(int arr[], int left, int right){
    int pivot = arr[right];
    int element = (left -1);
    for (int i = left; i < right; i++){
      if (arr[i] < pivot){
        element++;
        int buffer = arr[element];
        arr[element] = arr[i];
        arr[i] = buffer;
      }
    }
    element++;
    int buffer = arr[element];
    arr[element] = arr[right];
    arr[right] = buffer;
    return element;
  }
}