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 pure_code at 2012-02-18 20:59:02 on Problem 1734
这题记录路径一定要用数组pre[][]记录么?
我直接递归寻找路径,怎么WA呢?
路径上的点一定满足:dist[l][i] + dist[i][r] == dist[l][r]
递归函数如下,请看看问题出现在哪里
void create_end(int l, int r, int k) {
    int i;

    if(dist[l][r] == g[l][r]) {
        end[len++] = r;
        return ;
    }
    FOR(i, 1, k)
        if(i != l && i != r && dist[l][i] + dist[i][r] == dist[l][r]) {
            create_end(l, i, k);
            create_end(i, r, k);
        }
}

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