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:Why wa, not memory limit error?

Posted by anne2277 at 2005-06-30 10:55:32 on Problem 1159
In Reply To:Why wa, not memory limit error? Posted by:anne2277 at 2005-06-30 10:32:41
A good method to solve this problem is to determine the length L
of a longest common subsequence (maximal matching) for the input and
its reverse.  The answer then is N - L.  An alternative approach is
to match a prefix of the string with the reverse of a postfix.

The length of a longest common subsequence can be determined
by dynamic programming.  A triangular table can be constructed,
of which only two rows need to be stored.  The complexity
is then O(N) space and O(N^2) time.

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