|Online Judge||Problem Set||Authors||Online Contests||User|
After years of toil designing and evaluating varieties of complex networks, Michelle, an elite engineer, has recently made the decision to develop an assistant software to help herself out.
Consider a network built up with undirected water supply pipes each connecting a pair of junctions that supply or consume water. A shortcut of length L is defined as a sequence of L distinct junctions such that two junctions are adjacent in the network if and only if they are adjacent in the sequence. A network is regarded speedy if there is no shortcut with a length greater than three.
Now, please try to work out an efficient solution for Michelle to determine whether a network is speedy or not.
The input contains exactly one test case given as specified below:
You can assume that there exists a path between any two junctions.
4 4 1 2 2 3 3 4 4 1
POJ Monthly--2007.06.03, Jia, You
[Submit] [Go Back] [Status] [Discuss]
Home Page Go Back To top
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator