2029: [USACO 2024 February Contest Gold] Problem 1. Bessla Motors
题目描述
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 charging stations are labeled . The remaining points of interest are all travel destinations.
输出
样例输入
3 3 1 4 1
1 2 3
1 3 5
2 3 2
样例输出
1
2
提示
We have one charging station at . From this charging station, we can reach point (since it is distance away from ), but not point (since it is distance away from ). Thus, only point is well-connected.
SAMPLE INPUT:
4 3 2 101 2
1 2 1
2 3 100
1 4 10
SAMPLE OUTPUT:
2
3
4
We have charging stations at and , and both points and are within distance of both and . Thus, both points and are well-connected.
SAMPLE INPUT:
4 3 2 100 2
1 2 1
2 3 100
1 4 10
SAMPLE OUTPUT:
1
4
SCORING:
- Inputs 4 and 5: and and .
- Inputs 6 and 7: .
- Inputs 8-15: No additional constraints.