Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

86-tgyuuAn #265

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tgyuuAn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
| 61μ°¨μ‹œ | 2024.06.20 | 크루슀칼 | <a href="https://www.acmicpc.net/problem/1774">μš°μ£Όμ‹ κ³Όμ˜ ꡐ감</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/212
| 62μ°¨μ‹œ | 2024.07.01 | DP | <a href="https://www.acmicpc.net/problem/1949">우수 λ§ˆμ„</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/214
| 63μ°¨μ‹œ | 2024.07.08 | BFS | <a href="https://www.acmicpc.net/problem/3108">둜고</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/216
| 62μ°¨μ‹œ | 2024.07.01 | DP | <a href="https://www.acmicpc.net/problem/1949">우수 λ§ˆμ„</a> | https://github.com/AlgoLeadMe/AlgoLeadMse-1/pull/214
| 63μ°¨μ‹œ | 2024.07.08 | BFS | <a href="https://www.acmicpc.net/problem/3108">둜고</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/216
| 64μ°¨μ‹œ | 2024.07.12 | μ΅œμ†Œ 곡톡 쑰상 | <a href="https://www.acmicpc.net/problem/11812">K진 트리</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/217
| 65μ°¨μ‹œ | 2024.07.19 | μ΅œμ†Œ 곡톡 쑰상 | <a href="https://www.acmicpc.net/problem/3584">κ°€μž₯ κ°€κΉŒμš΄ 곡톡 쑰상</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/220
| 66μ°¨μ‹œ | 2024.07.22 | DP | <a href="https://www.acmicpc.net/problem/2169">λ‘œλ΄‡ μ‘°μ’…ν•˜κΈ°</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/222
Expand All @@ -88,4 +86,5 @@
| 82μ°¨μ‹œ | 2024.11.22 | ν¬μ†Œ λ°°μ—΄ | <a href="https://www.acmicpc.net/problem/17435">ν•©μ„±ν•¨μˆ˜μ™€ 쿼리</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/257
| 83μ°¨μ‹œ | 2024.12.01 | μˆ˜ν•™ + κ΅¬ν˜„ | <a href="https://www.acmicpc.net/problem/1033">μΉ΅ν…ŒμΌ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/259
| 84μ°¨μ‹œ | 2024.12.31 | BFS | <a href="https://www.acmicpc.net/problem/4179">뢈!</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/261
| 86μ°¨μ‹œ | 2025.01.16 | 이뢄 탐색 | <a href="https://www.acmicpc.net/problem/1114">ν†΅λ‚˜λ¬΄ 자λ₯΄κΈ°</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/265
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import sys

def input(): return sys.stdin.readline().rstrip()

L, K, C = map(int, input().split())
cut_points = sorted(list(map(int, input().split())))
cut_points = [0] + cut_points + [L]

def check(max_len):
cuts = 0
last_cut = L
for i in range(len(cut_points) - 1, 0, -1):
if cut_points[i] - cut_points[i - 1] > max_len:
return False
if last_cut - cut_points[i - 1] > max_len:
cuts += 1
last_cut = cut_points[i]
return cuts <= C

left, right = 1, L
answer = L
while left <= right:
mid = (left + right) // 2
if check(mid):
answer = mid
right = mid - 1
else:
left = mid + 1

cuts = 0
last_cut = L
first_cut = None
for i in range(len(cut_points) - 1, 0, -1):
if last_cut - cut_points[i - 1] > answer:
cuts += 1
last_cut = cut_points[i]
if C == cuts:
first_cut = cut_points[i]

if first_cut is None:
first_cut = cut_points[1]

print(answer, first_cut)
Loading