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 |

Language: The xor-longest Path
Description In an edge-weighted tree, the xor-length of a path ⊕ is the xor operator. We say a path the xor-longest path if it has the largest xor-length. Given an edge-weighted tree with n nodes, can you find the xor-longest path? Input The input contains several test cases. The first line of each test case contains an integer Output For each test case output the xor-length of the xor-longest path. Sample Input 4 0 1 3 1 2 4 1 3 6 Sample Output 7 Hint The xor-longest path is 0->1->2, which has length 7 (=3 ⊕ 4) Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator