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 liymouse at 2022-03-08 21:50:02 on Problem 1480
DUP是增加1个数,其余都是减少一个数。
要保证结束时栈只有一个数且中间计算都不会少于2个数,加上下面剪枝:
1. 操作个数必须是偶数(增加一个数就必须减少一个)
2. DUP个数为L/2
3. 到第i个操作为止,DUP个数必须保证>=i/2+1  (i从0开始)

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