From 2e2212435668dfc89ca506e6991f445671dda253 Mon Sep 17 00:00:00 2001 From: H0ngJu Date: Tue, 31 Dec 2024 15:07:05 +0900 Subject: [PATCH 1/3] 202-12-31 --- H0ngJu/README.md | 1 + ...0\354\213\244 \353\260\260\354\240\225.py" | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 "H0ngJu/\352\267\270\353\246\254\353\224\224/\355\232\214\354\235\230\354\213\244 \353\260\260\354\240\225.py" diff --git a/H0ngJu/README.md b/H0ngJu/README.md index b9d0d9a..75c8f0c 100644 --- a/H0ngJu/README.md +++ b/H0ngJu/README.md @@ -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 | diff --git "a/H0ngJu/\352\267\270\353\246\254\353\224\224/\355\232\214\354\235\230\354\213\244 \353\260\260\354\240\225.py" "b/H0ngJu/\352\267\270\353\246\254\353\224\224/\355\232\214\354\235\230\354\213\244 \353\260\260\354\240\225.py" new file mode 100644 index 0000000..44c2ce9 --- /dev/null +++ "b/H0ngJu/\352\267\270\353\246\254\353\224\224/\355\232\214\354\235\230\354\213\244 \353\260\260\354\240\225.py" @@ -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) \ No newline at end of file From ca885ee9bf27c1f6a577e47169f59f6017a1d7d3 Mon Sep 17 00:00:00 2001 From: H0ngJu Date: Mon, 6 Jan 2025 04:03:31 +0900 Subject: [PATCH 2/3] 2025-01-06 --- ...0\354\213\244 \352\260\234\354\210\230.py" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "H0ngJu/\354\240\225\353\240\254/\354\265\234\354\206\214 \355\232\214\354\235\230\354\213\244 \352\260\234\354\210\230.py" diff --git "a/H0ngJu/\354\240\225\353\240\254/\354\265\234\354\206\214 \355\232\214\354\235\230\354\213\244 \352\260\234\354\210\230.py" "b/H0ngJu/\354\240\225\353\240\254/\354\265\234\354\206\214 \355\232\214\354\235\230\354\213\244 \352\260\234\354\210\230.py" new file mode 100644 index 0000000..151073e --- /dev/null +++ "b/H0ngJu/\354\240\225\353\240\254/\354\265\234\354\206\214 \355\232\214\354\235\230\354\213\244 \352\260\234\354\210\230.py" @@ -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)) \ No newline at end of file From 742bec77bd6c2dacbe398810819cb1f4cbe5996c Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Thu, 16 Jan 2025 17:43:08 +0900 Subject: [PATCH 3/3] 2025-01-16 --- tgyuuAn/README.md | 3 +- ...4 \354\236\220\353\245\264\352\270\260.py" | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 "tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\355\206\265\353\202\230\353\254\264 \354\236\220\353\245\264\352\270\260.py" diff --git a/tgyuuAn/README.md b/tgyuuAn/README.md index db250b7..6883eb7 100644 --- a/tgyuuAn/README.md +++ b/tgyuuAn/README.md @@ -65,8 +65,6 @@ | 61차시 | 2024.06.20 | 크루스칼 | 우주신과의 교감 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/212 | 62차시 | 2024.07.01 | DP | 우수 마을 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/214 | 63차시 | 2024.07.08 | BFS | 로고 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/216 -| 62차시 | 2024.07.01 | DP | 우수 마을 | https://github.com/AlgoLeadMe/AlgoLeadMse-1/pull/214 -| 63차시 | 2024.07.08 | BFS | 로고 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/216 | 64차시 | 2024.07.12 | 최소 공통 조상 | K진 트리 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/217 | 65차시 | 2024.07.19 | 최소 공통 조상 | 가장 가까운 공통 조상 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/220 | 66차시 | 2024.07.22 | DP | 로봇 조종하기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/222 @@ -88,4 +86,5 @@ | 82차시 | 2024.11.22 | 희소 배열 | 합성함수와 쿼리 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/257 | 83차시 | 2024.12.01 | 수학 + 구현 | 칵테일 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/259 | 84차시 | 2024.12.31 | BFS | 불! | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/261 +| 86차시 | 2025.01.16 | 이분 탐색 | 통나무 자르기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/265 --- diff --git "a/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\355\206\265\353\202\230\353\254\264 \354\236\220\353\245\264\352\270\260.py" "b/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\355\206\265\353\202\230\353\254\264 \354\236\220\353\245\264\352\270\260.py" new file mode 100644 index 0000000..fbcdf99 --- /dev/null +++ "b/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\355\206\265\353\202\230\353\254\264 \354\236\220\353\245\264\352\270\260.py" @@ -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) \ No newline at end of file