Cod sursa(job #3178093)
Utilizator | Bora Ioan Alexandru Alexbora13 | Data | 30 noiembrie 2023 23:06:05 |
---|---|---|---|
Problema | Aprindere | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("aprindere.in");
ofstream fout("aprindere.out");
int n, m, x;
int c, t, nr, s, apasat;
bool stare[1001];
int main()
{
fin >> n >> m;
for(int i=0; i<n; i++)
fin >> stare[i];
while(m--)
{
apasat=0;
fin >> c >> t >> nr;
if(stare[c]==0)
s+=t, apasat=1;;
while(nr--)
{
fin >> x;
if(apasat)
stare[x]=!stare[x];
}
}
fout << s;
return 0;
}