Cod sursa(job #1428965)
| Utilizator | Data | 5 mai 2015 13:15:58 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream fin ("algsort.in" );
ofstream fout("algsort.out");
vector <int> V; int N, X;
inline void CodeExpert(){
fin >> N;
for(int i = 1; i <= N; i ++){
fin >> X;
V.push_back(X);
}
make_heap(V.begin(), V.end());
sort_heap(V.begin(), V.end());
vector<int>::iterator it;
for(it = V.begin(); it != V.end(); it ++)
fout << *it << " ";
return;
}
int main(){
CodeExpert();
return 0;
}
