由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 面试题求解
相关主题
求教EA一道面试题问一道 Interviewstreet 上的题 (JAVA)
Facebook Hacker CupInterview street上的一题求助
彭博 面试题问个面试题
请教一个题 string similarity请教一个面试题
贡献个面试题,目前狗狗都没找到.....Google 面试题 一道
问几道面试题问一个面试题
请教软件开发 的 几个面试题!一道program challenge的题
hackercup出结果了Google电话面试题目
相关话题的讨论汇总
话题: road话题: integers话题: output话题: day话题: her
进入JobHunting版参与讨论
1 (共1页)
Y*S
发帖数: 74
1
毕业很多年了。 现在有个面试题要求完成,读完后完全没有头绪,帮忙看看该怎么做
?万分感谢。
Ms.Kox enjoys her job, but she does not like to waste extra time traveling
to and from her office. After working for many years, she knows the shortest
-distance route to her office on a regular day.
Recently, the city began regular maintenance of various roads. Every day a
road gets blocked and no one can use it that day, but all other roads can be
used. You are Ms. Kox's new intern and she needs some help. Every day, you
need to determine the minimum distance that she has to travel to reach her
office.
Input Format
There are N cities numbered 0 to N-1 and M bidirectional roads.
The first line of the input contains two integers N and M.
M lines follow, each containing three space-separated integers u , v and
w, where u and v are cities connected by a bi-directional road and w is the
length of this road. There is at most one road between any two cities and
no road connects a city to itself.
The next line contains two integers S and D. S is the city where Ms. Kox
lives and D is the city where her office is located.
The next line contains an integer Q, the number of queries.
Q lines follow, each containing two integers u and v, where the road
between u and v has been blocked that day.
Constraints
0 < N < 200,000
0 < M < 200,000
0 < Q < 200,000
0 < w < 1001
0 <= S,D <= N
Output Format
Output Q lines, with each line containing the minimum distance Ms.Kox has to
travel on that day. If there is no path, print "Infinity".
Sample Input
6 9
0 1 1
1 2 1
2 3 1
3 4 1
4 5 1
2 4 5
3 5 8
1 3 3
0 2 4
0 5
9
0 1
1 2
2 3
3 4
4 5
2 4
3 5
1 3
0 2
Sample Output
7
6
6
8
11
5
5
5
5
c********t
发帖数: 5706
2
dijkstra's algorithm

shortest
be
you

【在 Y*S 的大作中提到】
: 毕业很多年了。 现在有个面试题要求完成,读完后完全没有头绪,帮忙看看该怎么做
: ?万分感谢。
: Ms.Kox enjoys her job, but she does not like to waste extra time traveling
: to and from her office. After working for many years, she knows the shortest
: -distance route to her office on a regular day.
: Recently, the city began regular maintenance of various roads. Every day a
: road gets blocked and no one can use it that day, but all other roads can be
: used. You are Ms. Kox's new intern and she needs some help. Every day, you
: need to determine the minimum distance that she has to travel to reach her
: office.

1 (共1页)
进入JobHunting版参与讨论
相关主题
Google电话面试题目贡献个面试题,目前狗狗都没找到.....
[合集] Google电话面试题目问几道面试题
两个Amazon面试题请教软件开发 的 几个面试题!
问道面试题hackercup出结果了
求教EA一道面试题问一道 Interviewstreet 上的题 (JAVA)
Facebook Hacker CupInterview street上的一题求助
彭博 面试题问个面试题
请教一个题 string similarity请教一个面试题
相关话题的讨论汇总
话题: road话题: integers话题: output话题: day话题: her