2756 - Gifts for Jerry 2756 - Gifts for Jerry 2756 - Gifts for Jerry

Estadísticas Env: 285 | AC: 45 | %AC: 15,79 | Puntuación: 2,82
Creado por José Carlos González Fernández
Adicionado por jcfernandez (2014-03-13)
Límites
Tiempo Total: 60000 MS | Tiempo Caso: 6000 MS |Memoria: 62 MB | Salida límite (mb): 64 MB | Tamaño: 14 KB
Lenguajes activados
Disponible en

Descripción

GusGus wants to give Jerry a new coat able to withstand a temperature of at most t (0 <= t <= 10^9) degrees, so he can go through the tunnels that have been built under the house of Tom. The tunnels always connect two ladders, which allow to go up to ground level. The tunnels may be traversed in either direction and each has a set temperature Ti(1 <= Ti <= 10^9) due to the depth to which it is, ensures that all the tunnels will have different temperatures. Travelling through a tunnel with a temperature higher than supported by the protective coat can cause death.


Jerry when moving through the tunnels always travels along a path in which the maximum temperature of the road is as small as possible, so he asks for help from you. He wants to know the number of different ways in which you can travel avoiding death. To simplify matters, the task takes into account only the beginning and the end of a road.
;jsessionid=4F497DBF6789348D8C912E92688FA6B3

GusGus wants to give Jerry a new coat able to withstand a temperature of at most t (0 <= t <= 10^9) degrees, so he can go through the tunnels that have been built under the house of Tom. The tunnels always connect two ladders, which allow to go up to ground level. The tunnels may be traversed in either direction and each has a set temperature Ti(1 <= Ti <= 10^9) due to the depth to which it is, ensures that all the tunnels will have different temperatures. Travelling through a tunnel with a temperature higher than supported by the protective coat can cause death.


Jerry when moving through the tunnels always travels along a path in which the maximum temperature of the road is as small as possible, so he asks for help from you. He wants to know the number of different ways in which you can travel avoiding death. To simplify matters, the task takes into account only the beginning and the end of a road.
;jsessionid=4F497DBF6789348D8C912E92688FA6B3

GusGus wants to give Jerry a new coat able to withstand a temperature of at most t (0 <= t <= 10^9) degrees, so he can go through the tunnels that have been built under the house of Tom. The tunnels always connect two ladders, which allow to go up to ground level. The tunnels may be traversed in either direction and each has a set temperature Ti(1 <= Ti <= 10^9) due to the depth to which it is, ensures that all the tunnels will have different temperatures. Travelling through a tunnel with a temperature higher than supported by the protective coat can cause death.


Jerry when moving through the tunnels always travels along a path in which the maximum temperature of the road is as small as possible, so he asks for help from you. He wants to know the number of different ways in which you can travel avoiding death. To simplify matters, the task takes into account only the beginning and the end of a road.
;jsessionid=4F497DBF6789348D8C912E92688FA6B3

Especificación de entrada

The input consists of a number of cases, each case starts with an integer M (1 <= M <= 10^5) representing the number of tunnels that exist, the following M lines contain three integers X, Y, Ti the description of a tunnel between the ladders X and Y with a temperature of Ti degrees, 1 <= X,Y <= 2^15. The next line contains a number Q (1 <= Q <= 10^5), the number of coats in the closet of GusGus, followed by Q lines with the temperature each coat can protect from.
;jsessionid=4F497DBF6789348D8C912E92688FA6B3
The input consists of a number of cases, each case starts with an integer M (1 <= M <= 10^5) representing the number of tunnels that exist, the following M lines contain three integers X, Y, Ti the description of a tunnel between the ladders X and Y with a temperature of Ti degrees, 1 <= X,Y <= 2^15. The next line contains a number Q (1 <= Q <= 10^5), the number of coats in the closet of GusGus, followed by Q lines with the temperature each coat can protect from.
;jsessionid=4F497DBF6789348D8C912E92688FA6B3
The input consists of a number of cases, each case starts with an integer M (1 <= M <= 10^5) representing the number of tunnels that exist, the following M lines contain three integers X, Y, Ti the description of a tunnel between the ladders X and Y with a temperature of Ti degrees, 1 <= X,Y <= 2^15. The next line contains a number Q (1 <= Q <= 10^5), the number of coats in the closet of GusGus, followed by Q lines with the temperature each coat can protect from.
;jsessionid=4F497DBF6789348D8C912E92688FA6B3

Especificación de salida

For each coat S answer how many pairs <A,B> (A < B) of ladders Jerry can select such that there is a path from the ladder A to the ladder B that Jerry can take if GusGus gives him the layer S.

;jsessionid=4F497DBF6789348D8C912E92688FA6B3

For each coat S answer how many pairs <A,B> (A < B) of ladders Jerry can select such that there is a path from the ladder A to the ladder B that Jerry can take if GusGus gives him the layer S.

;jsessionid=4F497DBF6789348D8C912E92688FA6B3
The input consists of a number of cases, each case starts with an integer M (1 <= M <= 10^5) representing the number of tunnels that exist, the following M lines contain three integers X, Y, Ti the description of a tunnel between the ladders X and Y with a temperature of Ti degrees, 1 <= X,Y <= 2^15. The next line contains a number Q (1 <= Q <= 10^5), the number of coats in the closet of GusGus, followed by Q lines with the temperature each coat can protect from.
;jsessionid=4F497DBF6789348D8C912E92688FA6B3

Ejemplo de entrada

5
1 2 1
1 3 5
1 4 4
2 3 2
3 4 3
3
10
2
1

Ejemplo de salida

6
3
1

Sugerencia(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recomendación

Hemos seleccionado cuidadosamente varios problemas similares: 2901 | 2482 | 4060 | 2350 | 1841 | 3092