일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 에라토스테네스의 체
- 백트래킹
- 다이나믹프로그래밍
- 누적합
- 분할정복
- 수학
- MST
- 투포인터
- 구현
- 자료구조
- GROUP BY
- 그래프 이론
- 그리디
- 우선순위큐
- 플로이드-워셜
- join
- 다이나믹 프로그래밍
- 크루스칼
- DP
- 다익스트라
- DFS
- BFS
- 다시
- 그래프 탐색
- 서브쿼리
- 트리
- 해시
- 브루트포스
- 시뮬레이션
- 재귀
- Today
- Total
목록분류 전체보기 (373)
기록하고 까먹지 말기

날짜 : 2023. 10. 19 사용 언어 : python 문제 코드 import sys def dfs(idx, nums): # print(type(nums)) if len(nums) == m: for i in range(m): print(nums[i], end=" ") print() return before = -1 for i in range(idx, n): if i == idx + 1: before = arr[idx] if before == arr[i]: continue nums.append(arr[i]) dfs(i, nums) nums.pop() n, m = map(int, sys.stdin.readline().split()) arr = list(map(int, sys.stdin.readline()..

날짜 : 2023. 10. 18 사용 언어 : python 문제 코드 import sys import copy def dust(): # 미세먼지 확장 tmp = copy.deepcopy(graph) for x in range(r): for y in range(c): if tmp[x][y] > 0: cnt = 0 # 확산개수 for i in range(4): nx, ny = x + dx[i], y + dy[i] if nx in range(r) and ny in range(c): # 범위 포함 if graph[nx][ny] != -1: # 청정기가 아닌 경우 cnt += 1 graph[nx][ny] += int(tmp[x][y] // 5) graph[x][y] -= int(tmp[x][y] // 5) * c..

날짜 : 2023. 10. 17 사용 언어 : python 문제 코드 import sys import copy n = int(sys.stdin.readline()) graph = list() for i in range(n): graph.append(list(map(int, sys.stdin.readline().split()))) dp_max = copy.deepcopy(graph[0]) dp_min = copy.deepcopy(graph[0]) # print(dp_max, dp_min) maxt = list() mint = list() for i in range(1, n): maxt = copy.deepcopy(dp_max) # 앞줄까지의 dp mint = copy.deepcopy(dp_min) for ..

날짜 : 2023. 10. 14 사용 언어 : python 문제 코드 def solution(fees, records): check = dict() # 입차, 출차 체크 parktime = dict() # 차량별 주차시간 res = dict() for i in range(len(records)): tmp, num, inout = records[i].split() hh, mm = tmp.split(":") time = int(hh) * 60 + int(mm) records[i] = [time, num, inout] if num not in check: check[num] = -1 parktime[num] = 0 res[num] = 0 for i in range(len(records)): time, num,..

날짜 : 2023. 10. 14 사용 언어 : python 문제 코드 오답코드 def solution(booktime): def timediff(before, after): hour = int(after[0]) - int(before[0]) minute = int(after[1]) - int(before[1]) if minute < 0: hour -= 1 minute += 60 return hour * 60 + minute time = list() for start, end in booktime: start = list(start.split(":")) end = list(end.split(":")) time.append([int(start[0]), int(start[1]), timediff(start, ..

날짜 : 2023. 10. 14 사용 언어 : python 문제 코드 def solution(picks, minerals): check = list() # 우선순위 리스트 pick = picks[0] + picks[1] + picks[2] if len(minerals) > pick * 5: # 현재 있는 곡괭이로 캘 수 없는 광물들 생략 minerals = minerals[:pick * 5] for i in range(0, len(minerals), 5): tmp = 0 for j in range(i, i + 5): if j not in range(len(minerals)): break if minerals[j] == "diamond": tmp += 25 elif minerals[j] == "iron":..

날짜 : 2023. 10. 12 사용 언어 : python 문제 코드 def solution(plans): def time_cal(a, b): # b와 a 시간계산(분) hour = (b[0] - a[0]) minute = (b[1] - a[1]) if minute < 0: hour -= 1 minute += 60 return hour * 60 + minute res = list() arr = list() for sub, time, cost in plans: # 전처리 h, m = time.split(":") arr.append([sub, int(h), int(m), int(cost)]) arr.sort(key = lambda x : (x[1], x[2])) # 시간 순으로 정렬 rest = list()..

날짜 : 2023. 10. 10 사용 언어 : python 문제 코드 import sys import heapq INF = int(1e20) def solution(operations): maxheap = list() minheap = list() hash = dict() cnt = 0 # 전체 큐에 남아있는 원소의 개수 for temp in operations: op, num = temp.split() num = int(num) if op == "I": # 삽입 cnt += 1 heapq.heappush(minheap, num) heapq.heappush(maxheap, num * (-1)) if num not in hash: hash[num] = 1 else: hash[num] += 1 continu..