Cod sursa(job #1764697)

Utilizator SirbuSirbu Ioan Sirbu Data 25 septembrie 2016 20:06:27
Problema Aprindere Scor 0
Compilator cpp Status done
Runda Teme Pregatire ACM Unibuc 2013 Marime 0.53 kb
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin ("aprindere.in");
ofstream fout ("aprindere.out");

bool v[1002];

int main()
{
    int n,m,c,tc,nrc,timp=0,x;
    fin >> n >> m;
    for (int i=0;i<n;i++) fin >> v[i];
    for (int i=1;i<=m;i++)
    {
      fin >> c >> tc >> nrc;
      if (v[c]==0)
      {
        timp+=tc;
        for (int j=1;j<=nrc;j++)
          fin >> x;
          v[x]=abs(v[x]-1);
      }
      else for (int j=1;j<=nrc;j++) fin >> x;
    }
    fout << timp << "\n";
}