还是以前的CSP题目简单呜呜,怎么什么时代黑利都赶上了
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int N=100010;
struct A{
int x,y,z;
}a[N];
int n;
int main()
{
cin>>n;
for(int i=1;i<=n;i++) a[i].y=0;
for(int i=1;i<=n;i++)
{
int m;
cin>>m>>a[i].x;
for(int j=1;j<m;j++)
{
int k;
cin>>k;
if(k<=0) a[i].x+=k;
else{
if(a[i].x!=k)
{
a[i].x=k;
a[i].y=1;
}
}
}
}
int sum=0;
int num=0;
int ans=0;
for(int i=1;i<=n;i++)
{
sum+=a[i].x;
if(a[i].y) num++;
if(a[i].y&&i+1<=n&&i+2<=n&&a[i+1].y&&a[i+2].y) ans++;
if(i==n-1){
if(a[i].y&&a[i+1].y&&a[1].y) ans++;
}
if(i==n){
if(a[i].y&&a[1].y&&a[2].y) ans++;
}
}
cout<<sum<<" "<<num<<" "<<ans;
return 0;
}