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 |
Re:只能做到16ms了,各位大牛帮忙看看还有哪能优化,附代码In Reply To:只能做到16ms了,各位大牛帮忙看看还有哪能优化,附代码 Posted by:yzhw at 2010-01-30 11:03:29 if(refer[pos]) return refer[pos]; 都说叫记忆化搜索咯。。就是搜索过不用再计算啦。。你干嘛只保留一个状态。 改一下用-1表示必败态。。1表示必胜态。。非0就不用搜索 void change(bool tar[],int pos) 的实现也可以优化。。 for (int i = pos+1; i<=20; i++) if ( !tar[i-pos] ) tar[i] = false; 鄙人比较菜就发现这两个优化。。不过绝对可以到0ms的 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator