Skip to content

Commit

Permalink
2024-04-03
Browse files Browse the repository at this point in the history
  • Loading branch information
pknujsp committed Apr 2, 2024
1 parent 01fbdd4 commit 6511bd9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 1 addition & 4 deletions pknujsp/BFS/42-다리 만들기.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
# BFS를 통해 같은 섬인 육지에 ID 할당
while queue:
r, c = queue.popleft()
# 육지 영역은 다리 영역 탐색 시에 제외함
costs[r][c] = -1

for dr, dc in directions:
nr, nc = r + dr, c + dc

Expand Down Expand Up @@ -73,4 +70,4 @@
elif matrix[nr][nc] > 1 and matrix[nr][nc] != curr_island_id:
min_cost = min(min_cost, cost + costs[nr][nc])

print(min_cost)
print(min_cost)
3 changes: 2 additions & 1 deletion pknujsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@
| 39차시 | 2024.03.19 || [디스크 컨트롤러](https://school.programmers.co.kr/learn/courses/30/lessons/42627) | [#163](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/163) |
| 40차시 | 2024.03.22 | 그리디 | [센서](https://www.acmicpc.net/problem/2212) | [#168](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/168) |
| 41차시 | 2024.03.25 | 다익스트라 | [알고스팟](https://www.acmicpc.net/problem/1261) | [#169](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/169) |
| 42차시 | 2024.03.29 | BFS | [다리 만들기](https://www.acmicpc.net/problem/2146) | [#173](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/173) |
| 42차시 | 2024.03.29 | BFS | [다리 만들기](https://www.acmicpc.net/problem/2146) | [#173](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/173) |
| 43차시 | 2024.04.03 | 그리디 | [저울](https://www.acmicpc.net/problem/2437) | [#175](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/175) |
13 changes: 13 additions & 0 deletions pknujsp/그리디/43-저울.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
N = int(input())
weights = list(map(int, input().split()))
weights.sort()

x = 0
for weight in weights:
# x + 1이 현재 추의 무게보다 작다면, 측정이 불가능함
if x + 1 < weight:
break

x += weight

print(x + 1)

0 comments on commit 6511bd9

Please sign in to comment.