Cod sursa(job #2495461)
Utilizator | Data | 19 noiembrie 2019 14:10:04 | |
---|---|---|---|
Problema | Aprindere | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | ad_hoc | Marime | 0.58 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("aprindere.in");
ofstream fout("aprindere.out");
int n, m, cost, c, tc, nrc, x;
bool a[1005];
int main()
{
fin >> n >> m;
for(int i=1; i<=n; i++)
fin >> a[i];
for(int i=1; i<=m; i++)
{
bool ok=0;
fin >> c >> tc >> nrc;
if(!a[i])
{
cost+=tc;
ok=1;
}
for(int j=1; j<=nrc; j++)
{
fin >> x;
if(ok)
a[i]=!a[i];
}
}
fout << cost;
return 0;
}