Pagini recente » Cod sursa (job #1562740) | Cod sursa (job #1164868) | Diferente pentru autumn-warmup-2007/solutii/runda-2 intre reviziile 20 si 19 | Profil M@2Te4i | Cod sursa (job #1187250)
#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;
}