Pagini recente » Cod sursa (job #784739) | Cod sursa (job #1591849) | Cod sursa (job #1597635) | Cod sursa (job #1286206) | Cod sursa (job #935139)
Cod sursa(job #935139)
/// Craciun Catalin (c)
#include <fstream>
#include <iostream>
using namespace std;
ifstream f("aprindere.in");
ofstream g("aprindere.out");
int n,m;
int nc;
long long t=0;
bool A[1010];
void aprindere(int indice){
}
int main(){
int i,j,indice;
int timp;
int x;
f>>n>>m;
for (i=1;i<=n;i++)
f>>A[i];
for (i=1;i<=m;i++){
f>>indice;
if (A[indice]==0){
f>>timp>>nc;
t+=timp;
for (j=1;j<=nc;j++){
f>>x;
if (A[x]==1)
A[x]=0;
else
A[x]==1;
}
}
else if (A[indice]==1){
f>>timp>>nc;
for (j=1;j<=nc;j++)
f>>x;
}
}
f.close();
g<<t<<"\n";
g.close();
return 0;
}