|
|
вернуться в форумWhen I used BFS,I found it would exceed the time limit. Does DFS also will exceed the time limit? Of course! Use DP... Thanks. BFS got AC. I had AC, when use BFS, I dont know, why you got TL... Maybe your progrm is incrorrect, because BFS really got AC! If BFS got AC, tests for this problem is extremely weak... you are wrong: we can construct graph with n = 100 verticles and BFS solve it in O(n^2) So as DFS)) no, DFS is bad for this problem: we must compute the shortest sequence of words so DFS can work as slow as backtracking, exponential time Maybe you're right but I ment DFS with some changes) I also do DFS and got Time Limit on test 6 |
|
|