Pagini recente » Monitorul de evaluare | Cod sursa (job #2434879) | Istoria paginii utilizator/stoicaandrei | Cod sursa (job #2014828) | Cod sursa (job #2450140)
#include <bits/stdc++.h>
using namespace std;
ifstream in("aprindere.in");
ofstream out("aprindere.out");
int n, m, v[1000], timp;
int main() {
in >> n >> m;
for (int i = 0; i < n; i++) {
in >> v[i];
}
for (int i = 0; i < m; i++) {
int c, t, nrc, x;
in >> c >> t >> nrc;
if (v[i] == 0) {
timp+=t;
for (int j = 0; j < nrc; j++) {
in >> x;
v[x] = -v[x];
}
}
else
for (int j = 0; j < nrc; j++)
in >> x;
}
out << timp;
}