| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:思路In Reply To:思路 Posted by:yuanchuanshun at 2010-08-27 20:41:47 > __int64 ans=0,low,up,tmp;
> for(i=1;i<=n;i++)
> {
> modify(b[i]);
> if(i==1||i==n) continue;
> tmp=Getsum(b[i]);
> low=tmp-1; //前面比它小的数的个数;
> up= (n-b[i]-i+tmp); //后面比它大的数的个数;
> ans+= low*up;
> //////
> up=i-tmp; //前面比它大的数的个数;
> low=b[i]-tmp; //后面比它小的数的个数;
> ans+= low*up;
> }
用离散化一下么?
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator