Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
注意到每个节点其实只有5种状态,然后BFS就可以大大加速了,内详In Reply To:怎么又跑这么慢,求100ms以内算法 Posted by:foreverlin at 2010-01-20 17:20:43 也就是说节点不需要一圈一圈地回转,第一次转到不是正负1的圈数之后(比如3圈),之后如果变本加厉地回转(可能是30圈),就一定不是最优的了。 故记录状态的数组只需开到 f[5001][5]。 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator