Skip to content

Commit

Permalink
2024-02-21
Browse files Browse the repository at this point in the history
  • Loading branch information
pknujsp committed Feb 21, 2024
1 parent 7e1d50c commit 09c5297
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pknujsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
| 31์ฐจ์‹œ | 2024.01.30 | SORT | [๋ฉ€ํ‹ฐ๋ฒ„์Šค โ…ก](https://www.acmicpc.net/problem/18869) | [#123](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/123) |
| 32์ฐจ์‹œ | 2024.02.04 | BFS | [์ˆจ๋ฐ”๊ผญ์งˆ 3](https://www.acmicpc.net/problem/13549) | [#127](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/127) |
| 33์ฐจ์‹œ | 2024.02.06 | ํ | [์ฒ ๋กœ](https://www.acmicpc.net/problem/13334) | [#132](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/132) |
| 34์ฐจ์‹œ | 2024.02.12 | BFS | [์ด๋ถ„ ๊ทธ๋ž˜ํ”„](https://www.acmicpc.net/problem/1707) | [#135](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/135) |
| 35์ฐจ์‹œ | 2024.02.18 | ๊ทธ๋ฆฌ๋”” | [์„ ๋ฌผํ• ์ธ](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/137) |
| 34์ฐจ์‹œ | 2024.02.12 | BFS | [์ด๋ถ„ ๊ทธ๋ž˜ํ”„](https://www.acmicpc.net/problem/1707) | [#135](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/135) |
| 35์ฐจ์‹œ | 2024.02.18 | ๊ทธ๋ฆฌ๋”” | [์„ ๋ฌผํ• ์ธ](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/137) |
| 36์ฐจ์‹œ | 2024.02.21 | ์ด์ง„ํƒ์ƒ‰ | [ํœด๊ฒŒ์†Œ ์„ธ์šฐ๊ธฐ](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/143) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
N, M, L = map(int, input().split())
array = list(map(int, input().split()))
array.sort()

left = 1
right = L - 1

min_max_distance = right

while left <= right:
max_distance = (left + right) // 2
extra_added = 0
last_installed_x = 0

for installed_x in array:
if installed_x - last_installed_x > max_distance:
extra_added += (installed_x - last_installed_x - 1) // max_distance

last_installed_x = installed_x

if L - last_installed_x > max_distance:
extra_added += (L - last_installed_x - 1) // max_distance

if extra_added > M:
left = max_distance + 1
else:
right = max_distance - 1

print(left)

0 comments on commit 09c5297

Please sign in to comment.