小明种苹果(续)

 

#include <bits/stdc++.h>
#include <vector>
#define TLE std::ios::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);   cout.precision(10);
using namespace std;
#define ll long long
const int mxn = 1e3+10;
const int inf = 0x3f3f3f;
ll read()
{
    char ch ; int flag = 1; ll col = 0;
    ch=getchar();
    while(ch>'9' || ch<'0') {if(ch=='-') flag = -1 , ch = getchar();}
    while(ch<='9' && ch>='0') {col = col*10+ch-'0' , ch=getchar();}
    return flag*col;
}
int main()
{TLE;

    ll n,m,in=-1,mx=0,k,ans,cnt=0;
    ll sum = 0;
    n = read();
    bool a[mxn] = {0} ;
    for(int i=1;i<=n;i++)
    {
        m = read();ans = read() ;
        for(int j=1;j<=m-1;j++)
        {
            k = read();
            if(k<=0)
                ans+=k;
            else
            {
                if(ans > k)
                    a[i] = true;
                ans = k ;
            }
        }
        sum+=ans;
    }
    ans = 0;
    a[n+1] = a[1] , a[n+2] = a[2] ;
    for(int i=1;i<=n;i++)
        if(a[i] && a[(i+1)] && a[(i+2)])
            ans++;
    cout<<sum<<" "<<count(a+1,a+1+n,true)<<" "<<ans<<endl;
    return 0;
}

 

posted @ 2019-11-28 23:36  __MEET  阅读(242)  评论(0编辑  收藏  举报