Cod sursa(job #3136839)
Utilizator | Prof Info profinfo114 | Data | 8 iunie 2023 22:11:05 |
---|---|---|---|
Problema | Aprindere | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.68 kb |
#include <iostream>
#include <fstream>
#define MAX 1002
using namespace std;
bool v[MAX];
int n,m,c,tc,nc,x;
ifstream fin("aprindere.in");
ofstream fout("aprindere.out");
int main()
{
fin >> n >> m;
for(int i = 0; i < n; i++){ /// cere cerinta sa fie indexate de la 0 ;(
fin >> v[i];
}
int ans = 0;
for(int i = 0; i < m; i++){
bool ok = false;
fin >> c >> tc >> nc;
if(!v[c]){
ok = true;
ans += tc;
}
for(int j = 1; j <= nc; j++){
fin >> x;
if(ok){
v[x] = !v[x];
}
}
}
fout << ans;
return 0;
}