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 |
这道题目的意图就是让你只用两次BFSIn Reply To:总是TLE...无语ing... Posted by:ice_lemon at 2007-03-04 22:28:17 首先把输入当中数值为4的节点保存起来, 初试化两个数组 a[],b[]值为INF 然后分别对start和end进行广搜,搜到4的节点时候记录步数,分别保存在a和b中 最后写一个for循环,a[i]+b[i]的最小值就是答案。 另外定义数组的时候最好动态初始化,免得会产生越界或者占用内存过大的麻烦。 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator