Pagini recente » Cod sursa (job #840438) | Cod sursa (job #183066) | Cod sursa (job #573457) | Cod sursa (job #1779664) | Cod sursa (job #1187249)
#include<fstream>
using namespace std;
ifstream in("aprindere.in");
ofstream out("aprindere.out");
const int nmax = 1006;
int v[nmax], aux[nmax], n, m, ad, camera, chestie, rasp;
int main(){
int player_unu=0;
in>>n>>m;
for(int i = 0; i<n; i++)
in>>v[i];
for(int j = 0; j<m; j++)
{
in>>camera>>ad>>chestie;
for(int i = 0; i<chestie; i++)
in>>aux[i];
if(v[camera]==0)
{
rasp += ad;
for(int i = 0; i<chestie; i++)
{
v[aux[i]]++;
v[aux[i]] %= 2;
}
}
}
out<<rasp<<'\n';
return player_unu;
}