Cod sursa(job #2246878)
Utilizator | Capris Ruth _ruthhhhh | Data | 27 septembrie 2018 17:35:55 |
---|---|---|---|
Problema | Aprindere | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.79 kb |
#include <fstream>
using namespace std;
ifstream fin("aprindere.in");
ofstream fout("aprindere.out");
int n, m;
int c, tc, nrc;
int v[1002];
int contor;
int main()
{
int x;
fin >> n >> m;
for(int i = 0; i <= n - 1 ; i ++)
{
fin >> v[i];
}
for(int i = 0; i <= m - 1; i ++)
{
fin >> c >> tc >> nrc;
if(v[c] == 0)
{
contor += tc;
for(int j = 1; j <= nrc; j ++)
{
fin >> x;
if(v[j] == 1)
v[j] = 0;
else
v[j] = 1;
}
}
else
{
for(int j = 1; j <= nrc; j ++)
fin >> x;
}
}
fout << contor;
return 0;
}