Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/14725
🧭 풀이 시간
40 분
👀 체감 난이도
✏️ 문제 설명
🐜 배경
개미굴(트리 구조) 안에 있는 먹이 정보들을 로봇 개미가 탐색하여 층별로 보내줍니다.
각 줄은 로봇 개미가 지나간 먹이의 경로를 의미합니다.
우리는 이 정보를 가지고 개미굴의 트리 구조를 시각화해야 합니다.
📥 입력
첫 줄: N (로봇 개미가 보낸 먹이 정보의 개수)
다음 N줄:
각 줄의 첫 번째 숫자 K: 경로 길이
다음 K개 문자열: 로봇 개미가 지나온 방(먹이)들
예:
###📤 출력
각 층마다 --를 붙여서 깊이를 표현
같은 층에 여러 방이 있으면 사전 순서로 출력
같은 방 이름이 반복되어도 중복 없이 하나만 출력
출력 예:
🔍 풀이 방법
Trie로 트리화 시킨다.
⏳ 회고
트리이 연습문제