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

WA的童鞋要注意思路

Posted by Star_gong at 2013-08-27 10:45:18 on Problem 3667
假设max_len表示最大可用连续区间,start_left_len是左起最大可用连续区间,end_right_len是结束于right的最大可用连续区间,预定房间数为bookNum。则有:
1、如果1~n区间的max_len值都比bookNum小,就无解,否则有解。
 
2、如果start_left_len>=bookNum,返回left

3、如果它的左儿子的max_len值大于等于bookNum,到左儿子里去找。
 
4、如果左儿子的end_right_len加上右儿子的start_left_len大于等于bookNum,直接返回mid-leftChild.end_right_len+1,一定记得是直接返回,不需要再递归查询,我在这里WA了
 
5、否则到右儿子里去找。

6、上面每一步只有前面的每一步都不成立时,才能执行到下一步

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