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

31642번 - Bessla Motors 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB185534830.189%

문제

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

A Bessla can travel up to 2ドルR$ miles (1ドル\le R\le 10^9$) on a single charge, allowing it to reach any destination within $R$ miles of a charging station. A destination is deemed well-connected if it is reachable from at least $K$ (1ドル\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 $N,ドル $M,ドル $C,ドル $R,ドル and $K$. Each of the following $M$ lines contains three space-separated integers $u_i,ドル $v_i,ドル and $\ell_i$ such that $u_i\neq v_i$.

The charging stations are labeled 1,ドル 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

We have one charging station at 1ドル$. From this charging station, we can reach point 2ドル$ (since it is distance 3ドル$ away from 1ドル$), but not point 3ドル$ (since it is distance 5ドル$ away from 1ドル$). Thus, only point 2ドル$ is well-connected.

예제 입력 2

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

예제 출력 2

2
3
4

We have charging stations at 1ドル$ and 2ドル,ドル and both points 3ドル$ and 4ドル$ are within distance 101ドル$ of both 1ドル$ and 2ドル$. Thus, both points 3ドル$ and 4ドル$ are well-connected.

예제 입력 3

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

예제 출력 3

1
4

힌트

출처

Olympiad > USA Computing Olympiad > 2023-2024 Season > USACO 2024 February Contest > Gold 1번

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

출처

대학교 대회

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

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