Skip to content

Commit

Permalink
2025-01-16
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Jan 16, 2025
1 parent d39d389 commit 742bec7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
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)

0 comments on commit 742bec7

Please sign in to comment.