From 2e66950c343eee6b932809f4c1ab550f89491b41 Mon Sep 17 00:00:00 2001 From: hangyeol Date: Fri, 14 Mar 2025 15:22:53 +0900 Subject: [PATCH 1/3] =?UTF-8?q?92=EC=B0=A8=201=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "live9/test92/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" diff --git "a/live9/test92/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" "b/live9/test92/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" new file mode 100644 index 00000000..932c273a --- /dev/null +++ "b/live9/test92/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" @@ -0,0 +1,21 @@ +import heapq + + +def solution(scoville, K): + count = 0 + + heapq.heapify(scoville) + + while scoville[0] < K: + if len(scoville) <= 1: + count = -1 + break + first_min_num = heapq.heappop(scoville) + second_min_num = heapq.heappop(scoville) + + mix_num = first_min_num + (second_min_num * 2) + + heapq.heappush(scoville, mix_num) + count += 1 + + return count \ No newline at end of file From f02248be34bbb16c30ef09de54eb245889f81eac Mon Sep 17 00:00:00 2001 From: hangyeol Date: Fri, 14 Mar 2025 15:23:01 +0900 Subject: [PATCH 2/3] =?UTF-8?q?92=EC=B0=A8=203=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "live9/test92/\353\254\270\354\240\2343/\353\260\261\355\225\234\352\262\260.py" diff --git "a/live9/test92/\353\254\270\354\240\2343/\353\260\261\355\225\234\352\262\260.py" "b/live9/test92/\353\254\270\354\240\2343/\353\260\261\355\225\234\352\262\260.py" new file mode 100644 index 00000000..9708b1c3 --- /dev/null +++ "b/live9/test92/\353\254\270\354\240\2343/\353\260\261\355\225\234\352\262\260.py" @@ -0,0 +1,22 @@ +def solution(book_time): + books = [] + + for start, end in book_time: + books.append((hour_to_minutes(start), 1)) + books.append((hour_to_minutes(end) + 10, -1)) + + books.sort() + + current_rooms = 0 + needed_rooms = 0 + + for time, type in books: + current_rooms += type + needed_rooms = max(needed_rooms, current_rooms) + + return needed_rooms + + +def hour_to_minutes(time): + hour, minute = map(int, time.split(":")) + return hour * 60 + minute From 4abd25e0e9effba5d5afebbaea29ab14e0cf4e9f Mon Sep 17 00:00:00 2001 From: hangyeol Date: Sun, 16 Mar 2025 18:43:36 +0900 Subject: [PATCH 3/3] =?UTF-8?q?92=EC=B0=A8=202=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "live9/test92/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" diff --git "a/live9/test92/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" "b/live9/test92/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" new file mode 100644 index 00000000..8633550a --- /dev/null +++ "b/live9/test92/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" @@ -0,0 +1,29 @@ +def solution(board, skill): + count = 0 + + diff = [[0] * (len(board[0])+1) for _ in range(len(board) + 1)] + + for type, r1, c1, r2, c2, degree in skill: + if type == 1: + degree = -degree + + diff[r1][c1] += degree + diff[r1][c2+1] -= degree + diff[r2+1][c1] -= degree + diff[r2+1][c2+1] += degree + + for i in range(len(board)): + for j in range(len(board[0])): + diff[i][j+1] += diff[i][j] + + for i in range(len(board)): + for j in range(len(board[0])): + diff[i+1][j] += diff[i][j] + + for i in range(len(board)): + for j in range(len(board[0])): + board[i][j] += diff[i][j] + if board[i][j] > 0: + count +=1 + + return count \ No newline at end of file