纯暴力题
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
const int N = 1e3 + 5;
#define ll long long
#define _for(i, a, b) for (int i = (a); i < (b);i++)
int drop[N];
ll tree[N];
int main(){
int n,e=0,t=0;
ll sum = 0;
cin >> n;
_for(i,0,n){
int op;
scanf("%d", &op);
scanf("%d", &tree[i]);
_for(j,0,op-1){
int m;
scanf("%d", &m);
if(m<=0){
tree[i] += m;
}else{
drop[i] = (m == tree[i]) ? drop[i] : 1;
tree[i] = m;
}
}
sum += tree[i];
}
_for(i,0,n){
if(drop[i]){
t++;
}
if (drop[i] && drop[(i + 1) % n] && drop[(i + 2) % n]){
e++;
}
}
cout << sum << " " << t << " " << e << endl;
return 0;
}