Cod sursa(job #786992)
| Utilizator | Data | 12 septembrie 2012 14:47:32 | |
|---|---|---|---|
| Problema | Aprindere | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
// 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;
}
