Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

思路

Posted by yuanchuanshun at 2010-08-27 20:41:47 on Problem 3928
__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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator