[20250320] BOJ / G1 / 버스 갈아타기 / 권혁준 #278
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/2536
🧭 풀이 시간
49분

👀 체감 난이도
✏️ 문제 설명
M*N의 격자에 어떤 선분 K개를 각각 K개의 버스가 다니고 있다.
출발점과 도착점이 주어지면, 이용해야 하는 최소 버스 수를 구해보자.
🔍 풀이 방법
[사용한 알고리즘]
모든 버스 쌍에 대해 교차 판정 수행한 뒤에 그래프를 구성해준다.
시작점과 도착점을 포함하는 버스들을 미리 전처리 해놓고 BFS를 돌려주었다.
⏳ 회고
인접 리스트로 구성하니까 메모리 초과가 떴고,
인접 행렬로 다시 짜니까 맞았다..