Cod sursa(job #1765866)

Utilizator SirbuSirbu Ioan Sirbu Data 27 septembrie 2016 02:35:40
Problema Aprindere Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin ("aprindere.in");
ofstream fout ("aprindere.out");

int 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";
}