Pagini recente » Borderou de evaluare (job #1639968) | Cod sursa (job #2250486) | Cod sursa (job #2497954) | Cod sursa (job #1592339) | Cod sursa (job #2282186)
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("algsort.in");
ofstream fout("algsort.out");
#define NMax 500010
int n;
int a[NMax];
void citire();
int main(){
citire();
make_heap(a, a + n);
sort_heap(a, a + n);
for(int i = 0; i < n; i++) fout << a[i] << ' ';
}
void citire(){
fin >> n;
for(int i = 0; i < n; i++) fin >> a[i];
}