[20250616] BOJ / G3 / 역사 / 김수연 #361
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/1613
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
사건의 전후 관계가 주어질 때, 주어진 두 사건의 전후 관계 구하기
(앞에 있는 번호의 사건이 먼저 일어났으면 -1, 뒤에 있는 번호의 사건이 먼저 일어났으면 1, 어떤지 모르면(유추할 수 없으면) 0을 출력)
🔍 풀이 방법
플로이드-워셜 알고리즘 사용
연관관계 주어지면 1로 초기화해두고, 플로이드 알고리즘 사용
INF로 남아있으면 전후관계 모르는거임
⏳ 회고
플로이드-워셜 알고리즘인걸 알면 쉬운데, 몰라서 힌트를 봤다.....