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 |
思路__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