Skip to content

[태연] 250626#353

Open
rhino-ty wants to merge 2 commits into
mainfrom
태연/250626

Hidden character warning

The head ref may contain hidden characters: "\ud0dc\uc5f0/250626"
Open

[태연] 250626#353
rhino-ty wants to merge 2 commits into
mainfrom
태연/250626

Conversation

@rhino-ty
Copy link
Copy Markdown
Contributor

@rhino-ty rhino-ty commented Jun 30, 2025

🍳 Algorithm approach and solution

문제는 아래와 같습니다.

  • 민식이가 모든 직원에게 뉴스를 전달
  • 각 직원은 정확히 한 명의 직속 상사를 가짐 (트리 구조)
  • 전화는 한 번에 한 사람씩, 정확히 1분 소요
  • 목표 => 모든 직원이 뉴스를 듣는 최소 시간 계산

그래서, DFS로 접근한 다음 오래 걸리는 부하 직원부터 재귀적으로 풀면 됩니다.

  1. 순차적 접근: '한 번에 한 사람씩' 조건으로 인해 부하 n명 => n분 소요
  2. 그리디: 오래 걸리는 부하부터 먼저 전화
    • 긴 일을 먼저 시작 => 짧은 일들이 먼저 끝남
    • 긴 일을 나중에 시작 => 모든 일이 긴 일에 맞춰서 늦어짐
  3. 재귀적 계산: 각 노드에서 모든 부하 완료까지의 시간 계산

@rhino-ty rhino-ty linked an issue Jun 30, 2025 that may be closed by this pull request
@rhino-ty rhino-ty self-assigned this Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Baekjoon] 뉴스 전하기

1 participant