第一题,用dfs就行.关键在于求刚到达路口的时间.关于时间的求解可以参考
https://code.google.com/codejam/contest/8284487/dashboard#s=a&a=0