Cod sursa(job #2498438)
Utilizator | Data | 23 noiembrie 2019 21:53:15 | |
---|---|---|---|
Problema | Aprindere | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | ad_hoc | Marime | 0.46 kb |
#include <fstream>
#include <algorithm>
using namespace std;
ifstream f("aprindere.in");
ofstream g("aprindere.out");
int n,m,c,t,x,tm,y,ok;
bool v[1005];
int main()
{
f>>n>>m;
for(int i=0;i<n;++i)f>>v[i];
for(int i=0;i<m;++i)
{
f>>c>>t>>x;ok=0;
if(!v[c])tm+=t,ok=1;
for(int j=0;j<x;++j)
{
f>>y;
if(ok)v[y]=(v[y]+1)%2;
}
}
g<<tm<<'\n';
return 0;
}