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:此题似乎有环,会造成内存MLE

Posted by bixiongquan at 2016-04-12 15:34:15 on Problem 1062
In Reply To:此题似乎有环,会造成内存MLE Posted by:278466061 at 2014-09-06 12:53:06
> 我用DP做的,不知道递归做可不可以
> 但是此题似乎有环,用递归的同学可以试试搞一组bool,只要一进入递归函数,就把该item对应的bool位写为true,继续递归再碰到同一个item(该bool位为true)的话就直接输出它的P值,这样可以防止进入死递归造成的MLE
> 我一开始是递归做发现MLE了,只是以为递归太深,但是我DP之后还是MLE就不明白了,后来我就如前面说的那样做就AC了,希望能帮到别人
> 恕我太懒,不想再重新写递归了,窃以为递归可行

感谢感谢!!确实是内环导致了MLE,我用的递归,可行。

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