Cod sursa(job #1082806)

Utilizator dan.ghitaDan Ghita dan.ghita Data 14 ianuarie 2014 22:12:15
Problema Aprindere Scor 100
Compilator cpp Status done
Runda Teme Pregatire ACM Unibuc 2013 Marime 0.56 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("aprindere.in");
ofstream g("aprindere.out");
int n, m, s, v[1004], x, y, z;
int main()
{
    f>>n>>m;
    for (int i=0; i<n; ++i)
        f>>v[i];

    while(m--)
    {
        f>>x>>y>>z;
        if (!v[x])
        {
            while(z--)
            {
                f>>x;
                if(v[x]) v[x]=0;
                else v[x]=1;
            }
            s+=y;
        }
        else
            while(z--)
                f>>x;
    }
    g<<s;
    return 0;
}