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

Re:怎么能快些?我写的求逆序数的函数是 n^2 的,总复杂度是 mn^2, 请教简单方法

Posted by timepp at 2005-10-26 23:43:21 on Problem 1007
In Reply To:怎么能快些?我写的求逆序数的函数是 n^2 的,总复杂度是 mn^2, 请教简单方法 Posted by:sunmoonstar_love at 2005-08-07 16:03:10
O(n):

从后往前数,不同字母出现的次数分别记录在不同变量里.
遇到一个字母,逆序数的增量是比这个字母小的所有字母的次数和.

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