局部变量毁我OI

· · 生活·游记

省流 : T2 100-> 56,200-> 156

哦,局部变量要赋初始值,神经病,没事,明年再来,哦,明年是不是要中考了

万世师表

    for(int h=1;h<n;h++)
    {
        int pos;  //<---------------这里
        for(int i=1;i<=n;i++)
            if(2ll*a[i]<=a[h]){pos=i;break;}
        while(pos<=n+1&&a[pos]>=a[h]-a[h+1]) pos++;
        for(int k=h+1;k<=n;k++)
        {
            if(2ll*a[k]<=a[h]) continue;
            while(pos-1>k&&a[pos-1]<a[h]-a[k]) 
                pos--;
            if(m-1-h<0) continue;
            int cnt=C(k-2,m-1-h);
            ans=(1ll*cnt*sum[pos]%mod+ans)%mod;
        }
    }