diff --git "a/alstjr7437/BFS/\353\260\261\354\241\260\354\235\230-\355\230\270\354\210\230.py" "b/alstjr7437/BFS/\353\260\261\354\241\260\354\235\230-\355\230\270\354\210\230.py"
new file mode 100644
index 0000000..6da86a6
--- /dev/null
+++ "b/alstjr7437/BFS/\353\260\261\354\241\260\354\235\230-\355\230\270\354\210\230.py"
@@ -0,0 +1,88 @@
+from collections import deque
+import sys
+
+dx = [0,0,-1,1]
+dy = [1,-1,0,0]
+r, c = map(int, input().split())
+
+water1 = deque()
+water2 = deque()
+visited = [[False] * c for _ in range(r)]
+
+swan1 = deque()
+swan2 = deque()
+visited2 = [[False] * c for _ in range(r)]
+
+# 1. 전체 호수 만들기
+river = []
+for i in range(r):
+ river.append(list(input()))
+
+day_count = 0
+
+# 2. 백조 위치 찾기와 물 위치 찾기
+swan = []
+for x in range(c):
+ for y in range(r):
+ if river[y][x] == "L":
+ swan.append([y,x])
+ river[y][x] = "."
+ if river[y][x] == ".":
+ water1.append([y, x])
+ visited[y][x] = True
+
+# 3. 백조를 큐에 추가
+swan1.append(swan[0])
+visited2[swan[0][0]][swan[0][1]] = True
+
+# 4. 하루에 한번씩 X 없애기(얼음 없애기)
+def break_ice():
+ # print("-------")
+ while water1:
+ y, x = water1.popleft()
+ # print(y, x, water1, water2)
+ river[y][x] = "."
+ for i in range(4):
+ nx = x + dx[i]
+ ny = y + dy[i]
+ if nx < 0 or nx >= c or ny < 0 or ny >= r:
+ continue
+ if not visited[ny][nx]:
+ if river[ny][nx] == ".":
+ water1.append([ny,nx])
+ else :
+ water2.append([ny,nx])
+ visited[ny][nx] = True
+
+# 5. 백조가 만나는지 체크하기
+def check_swan():
+ # print("-------")
+ while swan1 :
+ y, x = swan1.popleft()
+ # print(x,y,swan1, swan2)
+ if y == swan[1][0] and x == swan[1][1]:
+ print(day_count)
+ sys.exit()
+ for i in range(4):
+ nx = x + dx[i]
+ ny = y + dy[i]
+ if nx < 0 or nx >= c or ny < 0 or ny >= r:
+ continue
+ if not visited2[ny][nx]:
+ if river[ny][nx] == "." and visited2[ny][nx] == False:
+ swan1.append([ny,nx])
+ else :
+ swan2.append([ny,nx])
+ visited2[ny][nx] = True
+ return False
+
+# 만날때까지 돌리기
+while 1:
+ break_ice()
+ water1 = water2
+ water2 = deque()
+
+ check_swan()
+ swan1 = swan2
+ swan2 = deque()
+ day_count += 1
\ No newline at end of file
diff --git a/alstjr7437/README.md b/alstjr7437/README.md
index 1997ba8..dbca916 100644
--- a/alstjr7437/README.md
+++ b/alstjr7437/README.md
@@ -12,4 +12,5 @@
| 8차시 | 2024.02.14 | DP | 평범한 배낭 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/24 |
| 9차시 | 2024.02.17 | 그리디 | 전구와 스위치 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/29 |
| 10차시 | 2024.02.20 | BFS/DFS | 트리의 부모 찾기 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/33 |
-
+| 11차시 | 2024.02.23 | 해시 | 베스트 앨범 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/39 |
+| 12차시 | 2024.02.26 | BFS | 백조의 호수 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/41 |
diff --git "a/alstjr7437/\355\212\270\353\246\254/\355\212\270\353\246\254\354\235\230-\353\266\200\353\252\250-\354\260\276\352\270\260.py" "b/alstjr7437/\355\212\270\353\246\254/\355\212\270\353\246\254\354\235\230-\353\266\200\353\252\250-\354\260\276\352\270\260.py"
index 8221840..0e6a5aa 100644
--- "a/alstjr7437/\355\212\270\353\246\254/\355\212\270\353\246\254\354\235\230-\353\266\200\353\252\250-\354\260\276\352\270\260.py"
+++ "b/alstjr7437/\355\212\270\353\246\254/\355\212\270\353\246\254\354\235\230-\353\266\200\353\252\250-\354\260\276\352\270\260.py"
@@ -43,4 +43,4 @@ def bfs():
bfs()
for i in range(2, n+1):
- print(visited[i])
+ print(visited[i])
\ No newline at end of file
diff --git "a/alstjr7437/\355\225\264\354\213\234/\353\262\240\354\212\244\355\212\270\354\225\250\353\262\224.py" "b/alstjr7437/\355\225\264\354\213\234/\353\262\240\354\212\244\355\212\270\354\225\250\353\262\224.py"
new file mode 100644
index 0000000..98065d6
--- /dev/null
+++ "b/alstjr7437/\355\225\264\354\213\234/\353\262\240\354\212\244\355\212\270\354\225\250\353\262\224.py"
@@ -0,0 +1,30 @@
+def solution(genres, plays):
+ answer = []
+ dict = {}
+
+ # 딕셔너리 만들기
+ for i in range(len(genres)):
+ if genres[i] not in dict :
+ dict[genres[i]] = [[plays[i], i]]
+ else :
+ dict[genres[i]].append([plays[i],i])
+
+ # 딕셔너리 안에 재생회수로 재정렬
+ for genres, plays in dict.items():
+ dict[genres] = sorted(plays, key=lambda x: x[0], reverse=True)
+
+ # 각 장르 총합 계산
+ totals = {i: sum(j[0] for j in songs) for i, songs in dict.items()}
+
+ # 총합 기준으로 딕셔너리 순서 변경
+ sorted_data = {k: v for k, v in sorted(dict.items(), key=lambda item: totals[item[0]], reverse=True)}
+
+
+ # 정답 인덱스 추가 부분
+ for i in sorted_data.values():
+ answer.append(i[0][1])
+ if len(i) != 1:
+ answer.append(i[1][1])
+
+
+ return answer
\ No newline at end of file