#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
const int maxn = 1e5+10;
int num[maxn];
int main()
{
int n, m, x;
cin>>n;
int f1;
int t,d,e;
d=0;
int d1=0;
int maxx = 0;
t=d=e=0;
int tp=0;
for(int i=0; i<n; i++)
{
int s;
cin>>m>>s;
f1=0;
for(int j=1; j<m; j++)
{
cin>>x;
if(x>0)
{
if(s!=x)
{
f1=1;
}
s=x;
}
if(x<=0)
{
s+=x;
}
}
if(f1==1)
{
d++;
num[tp++] = i;
d1++;
maxx = max(d1, maxx);
}
else
{d1=0;}
t+=s;
//printf("%d\n", s);
}
//printf("###############\n");
for(int i=0; i<tp; i++)
{
//printf("%d%c", num[i]+1, i==tp-1?'\n':' ');
//printf("****%d %d %d %d\n", (num[i]+1)%n, num[(i+1)%n], (num[i]+2)%n, num[(i+2)%n]);
if(((num[i]+1)%n==num[(i+1)%tp])&&((num[i]+2)%n==num[(i+2)%tp]))
{
//printf("%d %d %d\n", num[i], num[(i+1)%tp], num[(i+2)%tp]);
e++;
}
}
printf("%d %d %d\n", t, d, e);
return 0;
}
/*
4
4 74 -7 -12 -5
5 73 -8 -6 59 -4
5 76 -5 -10 60 -2
5 80 -6 -15 59 0
*/
/*
5
4 10 0 9 0
4 10 -2 7 0
2 10 0
4 10 -3 5 0
4 10 -1 8 0
*/
/*
*/
201909-2 小明种苹果(续)
猜你喜欢
转载自blog.csdn.net/weixin_42137874/article/details/113513642
今日推荐
周排行