Cod sursa(job #1187250)

Utilizator dr_personalityEftime Andrei Horatiu dr_personality Data 17 mai 2014 23:27:52
Problema Aprindere Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#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;
}