Cod sursa(job #799240)
| Utilizator | Data | 18 octombrie 2012 13:43:57 | |
|---|---|---|---|
| Problema | Aprindere | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<stdio.h>
using namespace std;
int n,m,i,st[1000],t,ti=0,ok;
int c,nr_c,tmp,j;
int main()
{
freopen("aprindere.in","r",stdin);
freopen("aprindere.out","w",stdout);
scanf("%ld %ld",&n,&m);
for(i=0;i<n;i++)
scanf("%ld",&st[i]);
for(i=1;i<=m;i++)
{
scanf("%ld %ld %ld",&c,&t,&nr_c);
ok=0;
if(st[c]%2==0)
{
ok=1;
st[c]++;
ti+=t;
}
for(j=1;j<=nr_c;j++)
{
scanf("%ld",&tmp);
if(ok)
st[tmp]++;
}
}
printf("%ld",ti);
return 0;
}
