Pagini recente » Cod sursa (job #2908201) | Cod sursa (job #265151) | Cod sursa (job #1071162) | Rating Laurentiu Ploscaru (Lawasu) | Cod sursa (job #2897389)
#include <fstream>
using namespace std;
ifstream fin("aprindere.in");
ofstream fout("aprindere.out");
int n, m, v[1001], tmin;
int main()
{
fin >> n >> m;
for (int i = 0; i < n; i++)
{
fin >> v[i];
}
for (int i = 0; i < m; i++)
{
int c, t, nrc;
fin >> c >> t >> nrc;
bool ok = false;
if (v[c] == 0)
{
tmin += t;
ok = true;
}
for (int j = 0; j < nrc; j++)
{
int x;
fin >> x;
if (ok == true)
{
if (v[x] != 0) v[x] = 0;
else v[x] = 1;
}
}
}
fout << tmin;
return 0;
}