Cod sursa(job #1241241)
| Utilizator | Data | 13 octombrie 2014 00:29:23 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <fstream>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ifstream fin("algsort.in");
ofstream fout("algsort.out");
int n; fin >> n;
vector<int> V(n);
copy(istream_iterator<int>(fin), istream_iterator<int>(), V.begin());
make_heap(V.begin(), V.end());
sort_heap(V.begin(), V.end());
copy(V.begin(), V.end(), ostream_iterator<int>(fout, " "));
fout << endl;
return 0;
}
