Cod sursa(job #2104945)

Utilizator NToniBoSSNicolae Tonitza NToniBoSS Data 12 ianuarie 2018 13:55:49
Problema Interclasari Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <cstdio>
#include <queue>
#include <functional>
using namespace std;
priority_queue <int,vector<int>,greater<int>> q;
int main()
{
    int i,k,j,n,x;
    freopen("interclasari.in","r",stdin);
    freopen("interclasari.out","w",stdout);
    scanf("%d",&k);
    for(i=1; i<=k; i++){
        scanf("%d",&n);
        for(j=1; j<=n; j++){
            scanf("%d",&x);
            q.push(x);
        }
    }
    printf("%d\n",q.size());
    while(q.size()){
        printf("%d ",q.top());
        q.pop();
    }

    return 0;
}