PivotOJ

Bessla Motors

시간 제한: 3000ms메모리 제한: 1024MB출처: USACO 2024 February GoldBOJ 31642

문제

Farmer John would like to promote his line of Bessla electric tractors by showcasing Bessla's network of charging stations. He has identified NN (2≤N≤5⋅1042\le N\le 5\cdot 10^4) points of interest labeled 1…N1\dots N, of which the first CC (1≤C<N1\le C < N) are charging stations and the remainder are travel destinations. These points of interest are interconnected by MM (1≤M≤1051\le M\le 10^5) bidirectional roads, the ii-th of which connects distinct points uiu_i and viv_i (1≤ui,vi≤N1\le u_i, v_i\le N) and has length ℓi\ell_i miles (1≤ℓi≤1091\le\ell_i\le 10^9).

A Bessla can travel up to 2R2R miles (1≤R≤1091\le R\le 10^9) on a single charge, allowing it to reach any destination within RR miles of a charging station. A destination is deemed well-connected if it is reachable from at least KK (1≤K≤101\le K\le 10) distinct charging stations. Your task is to assist Farmer John in identifying the set of well-connected travel destinations.

입력

The first line contains five space-separated integers NN, MM, CC, RR, and KK. Each of the following MM lines contains three space-separated integers uiu_i, viv_i, and ℓi\ell_i such that ui≠viu_i\neq v_i.

The charging stations are labeled 1,2,…,C1, 2, \ldots, C. The remaining points of interest are all travel destinations.

출력

First, output the number of well-connected travel destinations on a single line. Then, list all well-connected travel destinations in ascending order, each on a separate line.

예제

예제 1

입력
3 3 1 4 1
1 2 3
1 3 5
2 3 2
출력
1
2

예제 2

입력
4 3 2 101 2
1 2 1
2 3 100
1 4 10
출력
2
3
4

예제 3

입력
4 3 2 100 2
1 2 1
2 3 100
1 4 10
출력
1
4
코드를 제출하려면 로그인하세요.