Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

[2023-09-25] sumin #266 #278

Merged
merged 1 commit into from
Sep 26, 2023
Merged

[2023-09-25] sumin #266 #278

merged 1 commit into from
Sep 26, 2023

Conversation

ksumini
Copy link
Contributor

@ksumini ksumini commented Sep 25, 2023

PR Summary

풀이시간: 25분

<input>
n: 집의 개수(2 ≤ N ≤ 200,000)
c: 공유기의 개수(2 ≤ C ≤ N)
집의 좌표 xi (0 ≤ xi ≤ 1,000,000,000)가 주어짐

<solution>

  1. 가장 인접한 두 공유기 사이의 거리를 이분탐색한다.
  2. 가장 인접한 집 간의 거리를 유지하면서 최대한 많은 공유기를 설치했을 때, C개 이상 설치할 수 있으면 정답의 후보가 된다.
  • 가능한 경우면, 거리를 더 크게 -> 더 적은 공유기 설치 가능
  • 불가능한 경우면, 거리를 더 작게 -> 더 많은 공유기 설치 가능

<시간복잡도>
O(nlogn)

@ksumini ksumini added the BOJ label Sep 25, 2023
@ksumini ksumini self-assigned this Sep 25, 2023
@ksumini ksumini linked an issue Sep 25, 2023 that may be closed by this pull request
Copy link
Contributor

@zsmalla zsmalla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 구조적으로 이분 탐색에서 이 구조가 제일 좋더라구요! 풀이도 깔끔하고 설명도 깔끔해서 따로 피드백 드릴 부분이 없습니다! 고생하셨어요 수민님!!


<solution>
1. 가장 인접한 두 공유기 사이의 거리를 이분탐색한다.
2. 가장 인접한 집 간의 거리를 유지하면서 최대한 많은 공유기를 설치했을 때, C개 이상 설치할 수 있으면 정답의 후보가 된다.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가장 깔끔한 설명 같습니다!

Copy link
Member

@Woo-Yeol Woo-Yeol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지수님과 풀이 과정이 유사하여서 크게 피드백 요소는 없었습니다! 고생하셨습니다 수민님!

Copy link
Contributor

@limstonestone limstonestone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지수님과 똑같은 구조네요!!
고생하셨습니다 수민님~!

@ksumini ksumini merged commit 0f169e8 into main Sep 26, 2023
@ksumini ksumini deleted the sumin-#266 branch September 26, 2023 10:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BOJ] 공유기 설치
4 participants