#666
Unrated
Bessla Motors
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Note: The time limit for this problem is 3s, 1.5x the default. The memory limit for this problem is 512MB, twice the default.

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

A Bessla can travel up to 2R2R miles (1R1091\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 (1K101\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 uiviu_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

1
2

예제 입력 2

4 3 2 101 2
1 2 1
2 3 100
1 4 10

예제 출력 2

2
3
4

예제 입력 3

4 3 2 100 2
1 2 1
2 3 100
1 4 10

예제 출력 3

1
4

점수

Inputs 4 and 5: K=2K = 2 and N500N \le 500 and M1000M\le 1000.Inputs 6 and 7: K=2K = 2.Inputs 8-15: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.