Skip to content

Commit

Permalink
Merge branch 'main' into 85-tgyuuAn
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn authored Jan 28, 2025
2 parents a1d6859 + f2a2a9d commit cb7c770
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
1 change: 1 addition & 0 deletions H0ngJu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
| 34์ฐจ์‹œ | 2024.11.19 | ๋ˆ„์ ํ•ฉ | [๊ฐœ๋˜ฅ๋ฒŒ๋ ˆ](https://www.acmicpc.net/problem/3020) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/256 |
| 35์ฐจ์‹œ | 2024.11.23 | DP | [์ „๊นƒ์ค„](https://www.acmicpc.net/problem/2565) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/258 |
| 36์ฐจ์‹œ | 2024.12.02 | ์ˆ˜ํ•™ | [๋จธ๋ฆฌ ํ†กํ†ก](https://www.acmicpc.net/problem/1241) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/260 |
| 36์ฐจ์‹œ | 2024.12.31 | ๊ทธ๋ฆฌ๋”” | [ํšŒ์˜์‹ค ๋ฐฐ์ •](https://www.acmicpc.net/problem/1931) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/261 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import sys

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

N = int(input()) # 100000
info = [tuple(map(int, input().split())) for _ in range(N)]


info.sort(key=lambda x: (x[1], x[0]))
# ์ตœ๋Œ€ํ•œ ๋งŽ์ด ๋„ฃ์œผ๋ ค๋ฉด ๋นจ๋ฆฌ ๋๋‚˜๋Š” ํšŒ์˜๋“ค์„ ์ •๋ ฌ์„ ํ•ด์•ผํ•จ
# ** ๋๋‚˜๋Š” ์‹œ๊ฐ„์ด ๊ฐ™์€ ๊ฒฝ์šฐ๋ฅผ ๊ณ ๋ คํ•ด์•ผํ•จ **

tmp_a,tmp_b = info[0][0], info[0][1]
answer = 1

for i in range(1,N):
a = info[i][0]
b = info[i][1]

if a >= tmp_b:
tmp_a, tmp_b = a, b
answer += 1

print(answer)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
import heapq

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

N = int(input()) # 100000
info = [tuple(map(int, input().split())) for _ in range(N)]
room = []

info.sort(key=lambda x: x[0])
heapq.heappush(room, info[0][1])
answer = 1

for i in range(1,N):
a, b = info[i][0], info[i][1]
if a >= room[0]:
heapq.heappop(room)
heapq.heappush(room, b)

print(len(room))
1 change: 1 addition & 0 deletions tgyuuAn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@
| 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
| 85์ฐจ์‹œ | 2025.01.09 | ๋‹ค์ต์ŠคํŠธ๋ผ + ์ด๋ถ„ ํƒ์ƒ‰ | <a href="https://www.acmicpc.net/problem/1800">์ธํ„ฐ๋„ท ์„ค์น˜</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/264
| 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 cb7c770

Please sign in to comment.