2024/07/16 4

[Python][백준] 10655. 마라톤 1/ 구현, 브루트포스 (S3)

링크🔗https://www.acmicpc.net/problem/10655🗒️파이썬 코드 풀이N = int(input())x_lst = []y_lst = []for _ in range(N): x,y = map(int,input().split()) x_lst.append(x) y_lst.append(y)sum = 0 for i in range(0,len(x_lst)-1): sum = sum + abs(x_lst[i]-x_lst[i+1]) + abs(y_lst[i]-y_lst[i+1])mn = 1e100for i in range(1,len(x_lst)-1): prev_mid = abs(x_lst[i-1] - x_lst[i]) + abs(y_lst[i-1] - y_lst[i]) ..

[Python][백준] 2583. 영역 구하기/ 그래프 탐색,DFS,BFS (S1)

링크🔗https://www.acmicpc.net/problem/2583🗒️파이썬 코드 풀이 (DFS)import syssys.setrecursionlimit(10**6)input = sys.stdin.readlineN, M, K = map(int, input().split())lst = [[0] * M for _ in range(N)]for _ in range(K): j1, i1, j2, i2 = map(int, input().split()) for i in range(i1, i2): for j in range(j1, j2): lst[i][j] = 1 di, dj = [0, -1, 0, 1], [1, 0, -1, 0]rs = []def d..