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 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 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