Logo
(追記) (追記ここまで)

6247번 - Widening of Channels 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB62373468.000%

문제

In the Waterland country, there are n lakes (numbered from 1 to n) and m channels between them. The width (in meters) of each channel is known. Navigation in the channels can be performed in both directions. It is known that a boat with width of one meter can reach any lake, starting from lake number 1.

Write program channels, which calculates the minimum number of channels that should be widened, so that a boat with width of k meters can make a trip between every two lakes (the boat can move from one lake to another, if its width is less than or equal to the width of the channel, connecting the lakes).

입력

On the first line of the standard input are given integers, n and m (1 < n ≤ 1000, 1 < m ≤ 100000).

On each of the next m lines are given three integers, i, j and w, showing that there is a channel of width w (1 ≤ w ≤ 200) between lakes, i and j (1 ≤ i, j ≤ n).

On the last line is given the integer k (1 ≤ k ≤ 200).

출력

On a line of the standard output the program have to write one integer: the minimum number of channels that should be widened.

제한

예제 입력 1

6 9
1 6 1
1 2 2
1 4 3
2 3 3
2 5 2
3 4 4
3 6 2
4 5 5
5 6 4
4

예제 출력 1

2

힌트

출처

Olympiad > International Autumn Tournament in Informatics > 2012 > Group B (Juniors) 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /