[백준] 19238번 - 스타트 택시 (파이썬)
# 스타트 택시 from collections import deque import sys input = sys.stdin.readline N, M, fuel = map(int, input().split()) # 지도 arr = [[]] for _ in range(N): arr.append([0]+list(map(int, input().split()))) # 현재 위치 taxi = list(map(int, input().split())) # 사람들 정보 people = [] for _ in range(M): people.append(list(map(int, input().split()))) dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] def find_person(): tx, ty =..
2022. 5. 14.
[백준] 8980번 - 택배 (파이썬)
# 택배 import sys input = sys.stdin.readline N, W = map(int, input().split()) box_num = int(input()) box_info = [] for _ in range(box_num): start, end, num = map(int, input().split()) box_info.append((start, end, num)) box_info.sort(key=lambda x: (x[1])) result = 0 arr = [W for _ in range(N+1)] for x, y, num in box_info: num = min(num, min(arr[x:y])) if num != 0: for i in range(x, y): arr[i] -= nu..
2022. 5. 13.
[백준] 1039번 - 교환 (파이썬)
# 교환 from collections import deque N, K = map(int, input().split()) M = len(str(N)) def bfs(N, K): visited = set() visited.add((N, 0)) q = deque() q.append((N, 0)) answer = 0 while q: n, k = q.popleft() if k == K: answer = max(answer, n) continue n = list(str(n)) for i in range(M-1): for j in range(i+1, M): if i == 0 and n[j] == '0': continue n[i], n[j] = n[j], n[i] nn = int(''.join(n)) if (nn, ..
2022. 5. 4.