Cod sursa(job #1790091)
Utilizator | Corvin Ghita corvinus2003 | Data | 27 octombrie 2016 19:46:40 |
---|---|---|---|
Problema | Aprindere | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <fstream>
using namespace std;
const int MAX = 1001;
int v[MAX], n, m, ans;
int main()
{
ifstream cin ("aprindere.in");
ofstream cout ("aprindere.out");
cin >> n >> m;
for (int i = 0; i < n; ++i)
cin >> v[i];
for (int i = 1; i <= n; ++i)
{
int c, t, nrc, ok = 0;
cin >> c >> t >> nrc;
if (v[c] == 0)
{
ans += t;
ok = 1;
}
for (int j = 1; j <= nrc; ++j)
{
int x;
cin >> x;
if (ok == 1)
v[x] = !v[x];
}
}
cout << ans;
return 0;
}