Cod sursa(job #2063951)

Utilizator MaxTeoTeo Oprescu MaxTeo Data 11 noiembrie 2017 17:26:06
Problema Sortare prin comparare Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.42 kb
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
using namespace std;

ifstream f("algsort.in");
ofstream g("algsort.out");

const int MAX_SIZE=500001;
int n;
vector <int> v;

int main()
{
    int x;
    f>>n;
    while(n--)
    {
        f>>x;
        v.push_back(x);
    }
    make_heap(all(v));
    sort_heap(all(v));
    for(auto a:v)
        g<<a<<" ";
    g<<"\n";
    return 0;
}