Cod sursa(job #917673)

Utilizator apopeid13Apopeid Alejandro apopeid13 Data 18 martie 2013 11:25:03
Problema Aprindere Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include<fstream>
using namespace std;
int t, tf, c, c2, nrc, n, m, C[1002], i;
int main(){
ifstream f("aprindere.in");
ofstream g("aprindere.out");
f>>n>>m;
for(i=0; i<n; i++)
f>>C[i];
for(;m--;){
f>>c>>t>>nrc;
if(C[c]==0){
tf+=t;
for(;nrc--;){
f>>c2;
C[c2]=1-C[c2];
}
}
else{
for(;nrc--;)
f>>c2;
}
}
g<<tf;
return 0;
}