Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Feb 6, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/14554

🧭 풀이 시간

20분

👀 체감 난이도

✏️ 문제 설명

정점 $N$개, 간선 $M$개인 무방향 그래프에서 $S$ -> $E$ 최단 경로의 개수 구하기

🔍 풀이 방법

다익스트라 돌면서 새로운 배열 C에 경로의 개수를 저장해 주었다.
C[i] = i까지 오는 최단 경로의 수

D[i]가 갱신될 때 C[i]까지 같이 갱신해주면 된다.
D[i]가 갱신되지 않고, 같은 값이 들어오면 경로 수를 C[i]에 더해줘야 한다.

⏳ 회고

Comparator의 비교 함수 리턴값은 항상 int여야 한다는 걸 처음 알았다..

@oncsr oncsr added the success 👍 해설을 보지 않고 풀었을 때 label Feb 6, 2025
@ShinHeeEul ShinHeeEul merged commit 2173bef into main Feb 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants