Cod sursa(job #1220617)

Utilizator goalexboxerFMI Alexandru Ionascu goalexboxer Data 17 august 2014 22:22:39
Problema Sortare prin comparare Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.59 kb
#include<fstream>
#include<vector>
#include<algorithm>
using namespace std;

#define FIN "algsort.in"
#define FOUT "algsort.out"
#define MAXSIZE 500002

ifstream f(FIN);
ofstream g(FOUT);

int n;
vector<int> v;

void read()
{
    f >> n;
    int x;
    for(int i=1; i<=n; i++)
    {
        f >> x;
        v.push_back(x);
    }
}

void solve()
{
    sort(v.begin(), v.end());
}

void write()
{
    for(vector<int>::iterator it = v.begin(); it != v.end(); it++)
    {
        g << *it << " ";
    }
}

int main()
{
    read();
    solve();
    write();
}