Cod sursa(job #2494571)
Utilizator | Data | 18 noiembrie 2019 09:30:14 | |
---|---|---|---|
Problema | Aprindere | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | ad_hoc | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("aprindere.in");
ofstream g("aprindere.out");
int n,m,S,a[1002],C,b;
int main()
{
f>>n>>m;
for(int i=0;i<n;++i)
f>>a[i];
for(int j,i=1;i<=m;++i)
{
f>>j>>C>>b;
if(a[j]==0)
{
S+=C;
for(int x;0<b;--b)
{
f>>x;
a[x]=1-a[x];
}
}
else for(int x;0<b;--b)f>>x;
}
g<<S;
}