Bessla Motors
시간 제한3초메모리 제한1024 MB
가중 무방향 그래프에서 처음 C개 충전소 중 K개 이상으로부터 거리 R 이내에 있는 여행지를 세고 오름차순으로 출력한다.
문제
Farmer John would like to promote his line of Bessla electric tractors by showcasing Bessla's network of charging stations. He has identified () points of interest labeled , of which the first () are charging stations and the remainder are travel destinations. These points of interest are interconnected by () bidirectional roads, the -th of which connects distinct points and () and has length miles ().
A Bessla can travel up to miles () on a single charge, allowing it to reach any destination within miles of a charging station. A destination is deemed well-connected if it is reachable from at least () 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 , , , , and . Each of the following lines contains three space-separated integers , , and such that .
The charging stations are labeled . 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.