Arquivo de 24 horas: Problema
2756  Gifts for Jerry 2756  Gifts for Jerry 2756  Gifts for Jerry
Estatísticas  Env: 285  AC: 45  %AC: 15,79  Pontoação: 2,82 
Criado por  José Carlos González Fernández 
Adicionado por  jcfernandez (20140313) 
Límiteis 
Tempo Total: 60000 MS

Tempo Caso:
6000 MS
Memória: 62 MB  Saída límite (mb): 64 MB  Tamanho:
14 KB

Lenguagens activados  
Disponivel em 
Descripção
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.
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.
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.
Especificação de entrada
Especificação de saída
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=83EE4C95DB11025853F20AB477F1283CFor 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=83EE4C95DB11025853F20AB477F1283CExemplo de entrada
5
1 2 1
1 3 5
1 4 4
2 3 2
3 4 3
3
10
2
1
Exemplo de saída
6
3
1