Cod sursa(job #2038916)

Utilizator matdibuDibu Matei matdibu Data 14 octombrie 2017 10:00:12
Problema Interclasari Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int m, n, x;
    ifstream f("interclasari.in");
    f >> m;
    priority_queue<int> q;
    while(m--)
    {
        f>>n;
        while(n--)
            f >> x, q.push(-x);
    }
    f.close();
    ofstream g("interclasari.out");
    g << q.size() << '\n';
    while(!q.empty())
        g << -q.top() << ' ', q.pop();
    g.close();
    return 0;
}