Cod sursa(job #2104938)

Utilizator NToniBoSSNicolae Tonitza NToniBoSS Data 12 ianuarie 2018 13:51:40
Problema Interclasari Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <fstream>
#include <queue>
#include <functional>
using namespace std;
priority_queue <int,vector<int>,greater<int>> q;
int main()
{
    int i,k,j,n,x;
    ifstream in("interclasari.in");
    ofstream out("interclasari.out");
    in>>k;
    for(i=1; i<=k; i++)
    {
        in>>n;
        for(j=1; j<=n; j++)
        {
            in>>x;
            q.push(x);
        }
    }
    out<<q.size()<<endl;
    while(q.size())
    {
        out<<q.top()<<" ";
        q.pop();
    }

    return 0;
}