Cod sursa(job #1123219)
Utilizator | Data | 25 februarie 2014 23:31:48 | |
---|---|---|---|
Problema | Interclasari | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.65 kb |
#include <fstream>
#include <algorithm>
#include <list>
using namespace std;
ifstream f("interclasari.in");
ofstream g("interclasari.out");
int ind[25],i,j,N,M,x;
list<int> v;
int main()
{
list<int>::iterator it=v.begin();
f>>N;
f>>M;
for (j=1;j<=M;++j)
f>>x,v.push_back(x);
for (i=1;i<N;++i)
{
it=v.begin();
f>>M;
for (j=1;j<=M;++j)
{
f>>x;
while (*it<x)++it;
v.insert(it,x);
}
}
for (it=v.begin();it!=v.end();++it)
g<<*it<<" ";
return 0;
}