Pagini recente » Cod sursa (job #917586) | Cod sursa (job #2104803) | Cod sursa (job #2589768) | Cod sursa (job #538998) | Cod sursa (job #786992)
Cod sursa(job #786992)
// aprindere.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
//#include "fstream"
using namespace std;
int n,m,i,st[1000],t,ti=0,ok;
int c,nr_c,tmp,j;
int main()
{
ifstream f("aprindere.in");
ofstream g("aprindere.out");
f>>n>>m;
for(i=0;i<=n-1;i++)
f>>st[i];
for(i=1;i<=m;i++)
{
f>>c>>t>>nr_c;
ok=0;
if(st[c]%2==0)
{
ok=1;
st[c]++;
ti+=t;
}
for(j=1;j<=nr_c;j++)
{
f>>tmp;
if(ok)
st[tmp]++;
}
}
g<<ti;
return 0;
}