From 07e9c2f15da058232a69f533da8c6a53a48a6b5b Mon Sep 17 00:00:00 2001 From: JSPark <48265129+pknujsp@users.noreply.github.com> Date: Tue, 6 Feb 2024 22:32:18 +0900 Subject: [PATCH 1/7] 2024-02-06 --- pknujsp/README.md | 3 +- .../33-\354\262\240\353\241\234.py" | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 "pknujsp/\355\201\220/33-\354\262\240\353\241\234.py" diff --git a/pknujsp/README.md b/pknujsp/README.md index d8568f58..9a9e4162 100644 --- a/pknujsp/README.md +++ b/pknujsp/README.md @@ -33,4 +33,5 @@ | 29차시 | 2024.01.18 | DFS, UNION-FIND | [순열 사이클](https://www.acmicpc.net/problem/10451) | [#112](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/112) | | 30차시 | 2024.01.23 | DP | [ABBC](https://www.acmicpc.net/problem/25381) | [#119](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/119) | | 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) | \ No newline at end of file +| 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) | \ No newline at end of file diff --git "a/pknujsp/\355\201\220/33-\354\262\240\353\241\234.py" "b/pknujsp/\355\201\220/33-\354\262\240\353\241\234.py" new file mode 100644 index 00000000..acf2420a --- /dev/null +++ "b/pknujsp/\355\201\220/33-\354\262\240\353\241\234.py" @@ -0,0 +1,28 @@ +from sys import * +from heapq import * + +points = [] + +for _ in range(int(stdin.readline().strip())): + h, o = map(int, stdin.readline().strip().split()) + points.append([min(h, o), max(h, o)]) + +points.sort(key=lambda x: x[1]) +D = int(stdin.readline().strip()) + +max_users = 0 +start_points_list = [] + +for start, destination in points: + if start + D < destination: + continue + heappush(start_points_list, start) + + while start_points_list: + if start_points_list[0] + D >= destination: + break + heappop(start_points_list) + + max_users = max(max_users, len(start_points_list)) + +print(max_users) From 5b540db17f43a145bf4b84ee670dae4f2e0f1808 Mon Sep 17 00:00:00 2001 From: JSPark <48265129+pknujsp@users.noreply.github.com> Date: Mon, 12 Feb 2024 23:01:20 +0900 Subject: [PATCH 2/7] 2024-02-12 --- ...4 \352\267\270\353\236\230\355\224\204.py" | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 "pknujsp/BFS/33-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" diff --git "a/pknujsp/BFS/33-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" "b/pknujsp/BFS/33-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" new file mode 100644 index 00000000..34b5a842 --- /dev/null +++ "b/pknujsp/BFS/33-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" @@ -0,0 +1,43 @@ +from sys import * +from collections import * + + +def bfs(start): + q = deque([start]) + groups[start] = 1 + + while q: + curr = q.popleft() + visited[curr] = True + + for adj in graph[curr]: + if visited[adj]: + continue + + if not groups[adj]: + groups[adj] = -groups[curr] + q.append(adj) + elif groups[adj] == groups[curr]: + return False + return True + + +for _ in range(int(stdin.readline())): + V, E = map(int, stdin.readline().split()) + graph = [[] for i in range(V + 1)] + + for _ in range(E): + a, b = map(int, stdin.readline().split()) + graph[a].append(b) + graph[b].append(a) + + groups = [0] * (V + 1) + visited = [False] * (V + 1) + result = None + + for i in range(1, V + 1): + if groups[i] == 0 and not bfs(i): + result = 'NO' + break + + print('YES' if not result else result) From e861d2b0830dfc3b13490dad118fb5ad3d022dfc Mon Sep 17 00:00:00 2001 From: JSPark <48265129+pknujsp@users.noreply.github.com> Date: Wed, 14 Feb 2024 14:37:02 +0900 Subject: [PATCH 3/7] 2024-02-14 --- pknujsp/README.md | 4 ++- ...40\353\254\274\355\225\240\354\235\270.py" | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 "pknujsp/\352\267\270\353\246\254\353\224\224/35-\354\204\240\353\254\274\355\225\240\354\235\270.py" diff --git a/pknujsp/README.md b/pknujsp/README.md index 9a9e4162..99ad2452 100644 --- a/pknujsp/README.md +++ b/pknujsp/README.md @@ -34,4 +34,6 @@ | 30차시 | 2024.01.23 | DP | [ABBC](https://www.acmicpc.net/problem/25381) | [#119](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/119) | | 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) | \ No newline at end of file +| 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.14 | 그리디 | [선물할인](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/137) | diff --git "a/pknujsp/\352\267\270\353\246\254\353\224\224/35-\354\204\240\353\254\274\355\225\240\354\235\270.py" "b/pknujsp/\352\267\270\353\246\254\353\224\224/35-\354\204\240\353\254\274\355\225\240\354\235\270.py" new file mode 100644 index 00000000..85520b1e --- /dev/null +++ "b/pknujsp/\352\267\270\353\246\254\353\224\224/35-\354\204\240\353\254\274\355\225\240\354\235\270.py" @@ -0,0 +1,36 @@ +from sys import * + +n, budget, max_sales = map(int, stdin.readline().split()) +gifts = sorted(list(map(int, stdin.readline().split()))) + +min_price_gift = max_price_gift = 0 +prices = 0 +sales = 0 + +for sale_gift in range(max_sales): + prices += gifts[sale_gift] // 2 + max_price_gift += 1 + + if prices > budget: + print(sale_gift) + exit() + +sales = max_price_gift - min_price_gift +while max_price_gift < n: + if sales < max_sales or max_sales == 0: + if max_sales == 0: + prices += gifts[max_price_gift] + else: + prices += gifts[max_price_gift] // 2 + + if prices > budget: + break + + max_price_gift += 1 + sales += 1 + else: + prices += gifts[min_price_gift] // 2 + min_price_gift += 1 + sales -= 1 + +print(max_price_gift) From 7e1d50c5df3f4ae14859114347d9b10cb33917be Mon Sep 17 00:00:00 2001 From: JSPark <48265129+pknujsp@users.noreply.github.com> Date: Sun, 18 Feb 2024 19:36:50 +0900 Subject: [PATCH 4/7] 2024-02-18 --- pknujsp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pknujsp/README.md b/pknujsp/README.md index 99ad2452..c9fac876 100644 --- a/pknujsp/README.md +++ b/pknujsp/README.md @@ -36,4 +36,4 @@ | 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.14 | 그리디 | [선물할인](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/137) | +| 35차시 | 2024.02.18 | 그리디 | [선물할인](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/137) | From 09c52974830d08a19985c4db334fcb4189a9f027 Mon Sep 17 00:00:00 2001 From: JSPark <48265129+pknujsp@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:24:28 +0900 Subject: [PATCH 5/7] 2024-02-21 --- pknujsp/README.md | 5 ++-- ...4 \354\204\270\354\232\260\352\270\260.py" | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 "pknujsp/\354\235\264\354\247\204\355\203\220\354\203\211/36-\355\234\264\352\262\214\354\206\214 \354\204\270\354\232\260\352\270\260.py" diff --git a/pknujsp/README.md b/pknujsp/README.md index c9fac876..606d5e96 100644 --- a/pknujsp/README.md +++ b/pknujsp/README.md @@ -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) | \ No newline at end of file diff --git "a/pknujsp/\354\235\264\354\247\204\355\203\220\354\203\211/36-\355\234\264\352\262\214\354\206\214 \354\204\270\354\232\260\352\270\260.py" "b/pknujsp/\354\235\264\354\247\204\355\203\220\354\203\211/36-\355\234\264\352\262\214\354\206\214 \354\204\270\354\232\260\352\270\260.py" new file mode 100644 index 00000000..277ba120 --- /dev/null +++ "b/pknujsp/\354\235\264\354\247\204\355\203\220\354\203\211/36-\355\234\264\352\262\214\354\206\214 \354\204\270\354\232\260\352\270\260.py" @@ -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) + \ No newline at end of file From c323feb7defa54ba527c336e0de2ed8e0a88da35 Mon Sep 17 00:00:00 2001 From: JSPark <48265129+pknujsp@users.noreply.github.com> Date: Sun, 3 Mar 2024 17:46:07 +0900 Subject: [PATCH 6/7] =?UTF-8?q?README=20URL=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pknujsp/README.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pknujsp/README.md b/pknujsp/README.md index 606d5e96..ab833635 100644 --- a/pknujsp/README.md +++ b/pknujsp/README.md @@ -21,20 +21,20 @@ | 17차시 | 2023.11.10 | 스택 | [짝지어 제거하기](https://school.programmers.co.kr/learn/courses/30/lessons/12973) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/54) | | 18차시 | 2023.11.13 | 구현 | [키패드 누르기](https://school.programmers.co.kr/learn/courses/30/lessons/67256) | [#60](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/60) | | 19차시 | 2023.11.17 | 구현 | [실패율](https://school.programmers.co.kr/learn/courses/30/lessons/42889) | [#64](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/64) | -| 20차시 | 2023.11.20 | 문자열 | [옹알이 (2)](https://school.programmers.co.kr/learn/courses/30/lessons/133499) | [#70](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/70) | -| 21차시 | 2023.11.23 | 맵 | [의상](https://school.programmers.co.kr/learn/courses/30/lessons/42578) | [#73](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/73) | -| 22차시 | 2023.11.26 | 그리디 | [구명보트](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#79](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/79) | -| 23차시 | 2023.11.30 | 다익스트라 | [지름길](https://www.acmicpc.net/problem/1446) | [#82](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/82) | -| 24차시 | 2023.12.23 | 플로이드와셜 | [순위](https://school.programmers.co.kr/learn/courses/30/lessons/49191) | [#88](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/88) | -| 25차시 | 2023.12.27 | BFS | [토마토](https://www.acmicpc.net/problem/7569) | [#93](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/93) | -| 26차시 | 2024.01.02 | 이진탐색 | [입국심사](https://school.programmers.co.kr/learn/courses/30/lessons/43238) | [#98](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/98) | -| 27차시 | 2024.01.05 | DP | [N으로 표현](https://school.programmers.co.kr/learn/courses/30/lessons/42895) | [#101](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/101) | -| 28차시 | 2024.01.16 | 그리디 | [무지의 먹방 라이브](https://school.programmers.co.kr/learn/courses/30/lessons/42891) | [#110](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/110) | -| 29차시 | 2024.01.18 | DFS, UNION-FIND | [순열 사이클](https://www.acmicpc.net/problem/10451) | [#112](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/112) | -| 30차시 | 2024.01.23 | DP | [ABBC](https://www.acmicpc.net/problem/25381) | [#119](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/119) | -| 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) | -| 36차시 | 2024.02.21 | 이진탐색 | [휴게소 세우기](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/lgoLeadMe/AlgoLeadMe-1/pull/143) | \ No newline at end of file +| 20차시 | 2023.11.20 | 문자열 | [옹알이 (2)](https://school.programmers.co.kr/learn/courses/30/lessons/133499) | [#70](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/70) | +| 21차시 | 2023.11.23 | 맵 | [의상](https://school.programmers.co.kr/learn/courses/30/lessons/42578) | [#73](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/73) | +| 22차시 | 2023.11.26 | 그리디 | [구명보트](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#79](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/79) | +| 23차시 | 2023.11.30 | 다익스트라 | [지름길](https://www.acmicpc.net/problem/1446) | [#82](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/82) | +| 24차시 | 2023.12.23 | 플로이드와셜 | [순위](https://school.programmers.co.kr/learn/courses/30/lessons/49191) | [#88](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/88) | +| 25차시 | 2023.12.27 | BFS | [토마토](https://www.acmicpc.net/problem/7569) | [#93](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/93) | +| 26차시 | 2024.01.02 | 이진탐색 | [입국심사](https://school.programmers.co.kr/learn/courses/30/lessons/43238) | [#98](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/98) | +| 27차시 | 2024.01.05 | DP | [N으로 표현](https://school.programmers.co.kr/learn/courses/30/lessons/42895) | [#101](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/101) | +| 28차시 | 2024.01.16 | 그리디 | [무지의 먹방 라이브](https://school.programmers.co.kr/learn/courses/30/lessons/42891) | [#110](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/110) | +| 29차시 | 2024.01.18 | DFS, UNION-FIND | [순열 사이클](https://www.acmicpc.net/problem/10451) | [#112](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/112) | +| 30차시 | 2024.01.23 | DP | [ABBC](https://www.acmicpc.net/problem/25381) | [#119](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/119) | +| 31차시 | 2024.01.30 | SORT | [멀티버스 Ⅱ](https://www.acmicpc.net/problem/18869) | [#123](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/123) | +| 32차시 | 2024.02.04 | BFS | [숨바꼭질 3](https://www.acmicpc.net/problem/13549) | [#127](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/127) | +| 33차시 | 2024.02.06 | 큐 | [철로](https://www.acmicpc.net/problem/13334) | [#132](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/132) | +| 34차시 | 2024.02.12 | BFS | [이분 그래프](https://www.acmicpc.net/problem/1707) | [#135](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/135) | +| 35차시 | 2024.02.18 | 그리디 | [선물할인](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137) | +| 36차시 | 2024.02.21 | 이진탐색 | [휴게소 세우기](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143) | \ No newline at end of file From 733bc212dda226551126f4870e15a073c603f0fe Mon Sep 17 00:00:00 2001 From: JSPark <48265129+pknujsp@users.noreply.github.com> Date: Sun, 3 Mar 2024 17:48:33 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=EC=9D=B4=EB=B6=84=EA=B7=B8=EB=9E=98?= =?UTF-8?q?=ED=94=84=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?33=20->=2034?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "pknujsp/BFS/33-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" => "pknujsp/BFS/34-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" (100%) diff --git "a/pknujsp/BFS/33-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" "b/pknujsp/BFS/34-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" similarity index 100% rename from "pknujsp/BFS/33-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py" rename to "pknujsp/BFS/34-\354\235\264\353\266\204 \352\267\270\353\236\230\355\224\204.py"