Cod sursa(job #1451774)
Utilizator | Data | 18 iunie 2015 14:52:32 | |
---|---|---|---|
Problema | Sortare prin comparare | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> V;
int main()
{
freopen("algsort.in","r",stdin);
freopen("algsort.out","w",stdout);
scanf("%d",&N);
V.resize(N);
for(int i = 0; i < N; ++i)
scanf("%d",&V[i]);
make_heap(V.begin(),V.end());
sort_heap(V.begin(),V.end());
for(auto it : V)
printf("%d ",it);
return 0;
}