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

Envío 1923

Problema 0xde - Ordenar un arreglo grande

  • Autor: ppastram
  • Fecha: 2020-11-10 18:48:15 UTC (Hace alrededor de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.005 s 2 KBi
#2
Correcto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.006 s 9 KBi
#3
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.007 s 1 KBi
#4
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.006 s 1 KBi
#5
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.006 s 1 KBi
#6
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.006 s 3 KBi
#7
Incorrecto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.008 s 1 KBi
#8
Incorrecto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.006 s 1 KBi
#9
Incorrecto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.006 s 1 KBi
#10
Incorrecto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.006 s 1 KBi
#11
Incorrecto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.005 s 1 KBi
#12
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 139
run: line 1:     3 Segmentation fault      (core dumped) ./a.out
0.007 s 1 KBi
#13
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.006 s 1 KBi
#14
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 139
run: line 1:     3 Segmentation fault      (core dumped) ./a.out
0.006 s 1 KBi
#15
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.006 s 1 KBi
#16
Incorrecto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.006 s 1 KBi
#17
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 139
run: line 1:     3 Segmentation fault      (core dumped) ./a.out
0.005 s 1 KBi
#18
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.006 s 1 KBi
#19
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.007 s 1 KBi
#20
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.007 s 1 KBi
#21
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.007 s 1 KBi
#22
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.006 s 1 KBi
#23
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 132
run: line 1:     3 Illegal instruction     (core dumped) ./a.out
0.006 s 1 KBi
#24
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 139
run: line 1:     3 Segmentation fault      (core dumped) ./a.out
0.006 s 1 KBi
#25
Error en tiempo de ejecución (NZEC)
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
Exited with error status 139
run: line 1:     3 Segmentation fault      (core dumped) ./a.out
0.006 s 1 KBi
#26
Incorrecto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.006 s 1 KBi
#27
Incorrecto
                      main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

                    
0.005 s 1 KBi
Puntos totales: 4 / 100

Código

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <set>
#include <list>
#include <map>
#include <vector>
#include <stack>
#include <algorithm>
#define forn(a, n) for(int a = 0; a<(int) (n); ++a)
#define rforn(a, n) for(int a = (n)-1; a>=0; --a)
using namespace std;
const int N = 6e5+20;

int partition(int a[], int low, int high)
{
    int pivot = a[high];
    int i = low-1;

    for(int j = low; j < high; j++)
    {
        if(a[j] < pivot)
        {
            i++;
            swap(a[j], a[i]);
        }
    }
}

void quicksort(int a[], int low, int high)
{
    if(low < high)
    {
        int pi = partition(a, low, high);
        quicksort(a, low, pi-1);
        quicksort(a, pi+1, high);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, pos, temp, este, low, high;
    cin>>n;
    int a [1001];
    //vector <int> a;
    for(int i = 0; i < n; i++)
    {
        cin>>a[i];
        //cin>>este;
       //a.push_back(este);
    }
    

    // --- QUICK SORT --- -> XXX
    low = 0;
    high = n-1;
    quicksort(a, low, high);


    // --- MERGE SORT --- -> XXX
    

    for(int i = 0; i < n; i++)
    {
        cout<<a[i]<<" ";
    }
    cout<<endl;
}