Problem B: Audiophobia 噪音恐惧症
Consider yourself lucky! Consider yourself lucky to be still breathing and having fun participating in this contest.
你是幸运的!你是幸运的仍有呼吸和快乐的参加这次竞赛
But we apprehend that many of your descendants may not have this luxury.
但是我们发现很多你的后代可能没有这些奢侈了
For, as you know, we are the dwellers of one of the most polluted cities on earth.
如你所知道,我们是地球上污染最严重的城市居民
Pollution is everywhere, both in the environment and in society and our lack of consciousness is simply aggravating the situation.
污染无处不在,无论是环境还是社会与我们的意识缺乏是简单恶化的局势
However, for the time being, we will consider only one type of pollution - the sound pollution.
然而,随着时间的推移,我们将意思到仅有一种类型的污染--声音污染
The loudness or intensity level of sound is usually measured in decibels and sound having intensity level 130 decibels or higher is considered painful.
噪音或声音的强度水平通常测量在分贝和声音强度水平130分贝或者高于是认为痛苦
The intensity level of normal conversation is 6065 decibels and that of heavy traffic is 7080 decibels.
普通谈话的强度水平是6065分贝 交通拥挤是7080分贝
Consider the following city map where the edges refer to streets and the nodes refer to crossings.
考虑到下列城市地图边代表街,节点代表通道
The integer on each edge is the average intensity level of sound (in decibels) in the corresponding street.
每条边上的整数是平均声音高度水平(分贝)在相应的街上
To get from crossing A to crossing G you may follow the following path: ACFG.
从交叉A到交叉G,你可以遵行以下路径 ACFG.
In that case you must be capable of tolerating sound intensity as high as 140 decibels.
在这种情况下你必须容忍程度声音强度高达140分贝
For the paths ABEG, ABDG and ACFDG you must tolerate respectively 90, 120 and 80 decibels of sound intensity.
路径ABEG, ABDG 和 ACFDG 你必须容忍声音强度分别为 90, 120 和 80分贝
There are other paths, too. However, it is clear that ACFDG is the most comfortable path since it does not demand you to tolerate more than 80 decibels.
还有其他路径,也,然而,很明显ACFDG最轻松的路径,由于它不要求你容忍超过80分贝
In this problem, given a city map you are required to determine the minimum sound intensity level you must be able to tolerate in order to get from a given crossing to another.
在这个问题,给一个城市地图,你需要确定最小声音强度级别,你必须能忍受 为了得到 一个给定的交叉到另一个交叉
Input
The input may contain multiple test cases.
输入包含多个案例
The first line of each test case contains three integersC(<=100),S(<=1000)and Q(<=10000)where C indicates the number of crossings (crossings are numbered using distinct integers ranging from 1 to C), S represents the number of streets and Q is the number of queries.
每个测试案例第一行包含3个整数C(<=100),S(<=1000)和Q(<=10000) C表示交叉的个数(交叉数使用不同整数编号从1到C),S代表街道数,Q代表查询的数字
Each of the next S lines contains three integers: c1, c2 and d indicating that the average sound intensity level on the street connecting the crossings c1 and c2 (c1≠c2) is d decibels.
接下来S行包含3个整数:c1,c2和d表明,连接c1到c2(c1≠c2)平均声音强度级别是d分贝
Each of the next Q lines contains two integers c1 and c2 (c1≠c2) asking for the minimum sound intensity level you must be able to tolerate in order to get from crossing c1 to crossing c2.
接下来Q行包含2个整数c1和c2(c1≠c2)
The input will terminate with three zeros form C, S and Q.
输入将以3个0终止 C,S,Q
Output
For each test case in the input first output the test case number (starting from 1) as shown in the sample output.
每个测试案例 第一行输入 输出测试数字(从1开始)作为样本输出显示
Then for each query in the input print a line giving the minimum sound intensity level (in decibels) you must be able to tolerate in order to get from the first to the second crossing in the query.
对于每个查询打印一行最小声音强度级别(分贝)你必须能忍受第一到第二交叉查询
If there exists no path between them just print the line ``no path".
如果没有路径在他们之间,打印"no path"
Print a blank line between two consecutive test cases.
打印一空行在2个连接案例之间
Consider yourself lucky! Consider yourself lucky to be still breathing and having fun participating in this contest.
你是幸运的!你是幸运的仍有呼吸和快乐的参加这次竞赛
But we apprehend that many of your descendants may not have this luxury.
但是我们发现很多你的后代可能没有这些奢侈了
For, as you know, we are the dwellers of one of the most polluted cities on earth.
如你所知道,我们是地球上污染最严重的城市居民
Pollution is everywhere, both in the environment and in society and our lack of consciousness is simply aggravating the situation.
污染无处不在,无论是环境还是社会与我们的意识缺乏是简单恶化的局势
However, for the time being, we will consider only one type of pollution - the sound pollution.
然而,随着时间的推移,我们将意思到仅有一种类型的污染--声音污染
The loudness or intensity level of sound is usually measured in decibels and sound having intensity level 130 decibels or higher is considered painful.
噪音或声音的强度水平通常测量在分贝和声音强度水平130分贝或者高于是认为痛苦
The intensity level of normal conversation is 6065 decibels and that of heavy traffic is 7080 decibels.
普通谈话的强度水平是6065分贝 交通拥挤是7080分贝
Consider the following city map where the edges refer to streets and the nodes refer to crossings.
考虑到下列城市地图边代表街,节点代表通道
The integer on each edge is the average intensity level of sound (in decibels) in the corresponding street.
每条边上的整数是平均声音高度水平(分贝)在相应的街上
To get from crossing A to crossing G you may follow the following path: ACFG.
从交叉A到交叉G,你可以遵行以下路径 ACFG.
In that case you must be capable of tolerating sound intensity as high as 140 decibels.
在这种情况下你必须容忍程度声音强度高达140分贝
For the paths ABEG, ABDG and ACFDG you must tolerate respectively 90, 120 and 80 decibels of sound intensity.
路径ABEG, ABDG 和 ACFDG 你必须容忍声音强度分别为 90, 120 和 80分贝
There are other paths, too. However, it is clear that ACFDG is the most comfortable path since it does not demand you to tolerate more than 80 decibels.
还有其他路径,也,然而,很明显ACFDG最轻松的路径,由于它不要求你容忍超过80分贝
In this problem, given a city map you are required to determine the minimum sound intensity level you must be able to tolerate in order to get from a given crossing to another.
在这个问题,给一个城市地图,你需要确定最小声音强度级别,你必须能忍受 为了得到 一个给定的交叉到另一个交叉
Input
The input may contain multiple test cases.
输入包含多个案例
The first line of each test case contains three integersC(<=100),S(<=1000)and Q(<=10000)where C indicates the number of crossings (crossings are numbered using distinct integers ranging from 1 to C), S represents the number of streets and Q is the number of queries.
每个测试案例第一行包含3个整数C(<=100),S(<=1000)和Q(<=10000) C表示交叉的个数(交叉数使用不同整数编号从1到C),S代表街道数,Q代表查询的数字
Each of the next S lines contains three integers: c1, c2 and d indicating that the average sound intensity level on the street connecting the crossings c1 and c2 (c1≠c2) is d decibels.
接下来S行包含3个整数:c1,c2和d表明,连接c1到c2(c1≠c2)平均声音强度级别是d分贝
Each of the next Q lines contains two integers c1 and c2 (c1≠c2) asking for the minimum sound intensity level you must be able to tolerate in order to get from crossing c1 to crossing c2.
接下来Q行包含2个整数c1和c2(c1≠c2)
The input will terminate with three zeros form C, S and Q.
输入将以3个0终止 C,S,Q
Output
For each test case in the input first output the test case number (starting from 1) as shown in the sample output.
每个测试案例 第一行输入 输出测试数字(从1开始)作为样本输出显示
Then for each query in the input print a line giving the minimum sound intensity level (in decibels) you must be able to tolerate in order to get from the first to the second crossing in the query.
对于每个查询打印一行最小声音强度级别(分贝)你必须能忍受第一到第二交叉查询
If there exists no path between them just print the line ``no path".
如果没有路径在他们之间,打印"no path"
Print a blank line between two consecutive test cases.
打印一空行在2个连接案例之间