Cod sursa(job #3266795)

Utilizator tudorpisica@gmail.comPisica Tudor [email protected] Data 10 ianuarie 2025 16:00:52
Problema Aprindere Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb


#include <bits/stdc++.h>

using namespace std;

ifstream in("aprindere.in");
ofstream out("aprindere.out");

int main()
{
    
    
    int n, m, v[1001], a, b, c, d, s = 0;
    
    in >> n >> m;
    
    for(int i = 0; i < n; i++)
        in >> v[i];

    for(int i = 0; i < m; i++){
        in >> a >> b >> c;
        
        for(int j = 0; j < c; j++){
            in >> d;
                if(!v[d]){
                s += c;
                v[d] = 1;
            }
        }
    }
    
    out << s;

    return 0;
}