문제풀이

https://www.acmicpc.net/problem/5549 코드import sysinput = sys.stdin.readlinem, n = map(int, input().split())k = int(input())map_data = [input() for _ in range(m)]# 누적합accum = [[[0]*3 for _ in range(n+1)] for _ in range(m+1)]for i in range(1, m+1): for j in range(1, n+1): accum[i][j][0] = accum[i-1][j][0]+accum[i][j-1][0]-accum[i-1][j-1][0] accum[i][j][1] = accum[i-1][j][1]+accum[..
https://www.acmicpc.net/problem/6593 코드from collections import dequedx = [1, -1, 0, 0, 0, 0]dy = [0, 0, 1, -1, 0, 0]dz = [0, 0, 0, 0, 1, -1]while True: l, r, c = map(int, input().split()) if l == 0 and r == 0 and c == 0: break q = deque() visited = [[[False]*c for _ in range(r)] for _ in range(l)] dest = [] cube = [[] for _ in range(l)] for i in range(l): for j..
https://www.acmicpc.net/problem/16401 코드m, n = map(int, input().split())l = list(map(int, input().split()))s, e = 1, max(l)ans = 0while s = m: s = mid+1 ans = mid else: e = mid-1print(ans)
https://www.acmicpc.net/problem/1911 코드from math import ceilimport sysinput = sys.stdin.readlinen, l = map(int, input().split())woongs = []for _ in range(n): s, e = map(int, input().split()) woongs.append((s, e))woongs.sort()ans = 0prev = -1_000_000for i in range(n): if prev  prev는 이전에 깔았던 널빤지 중 가장 끝의 널빤지의 끝 위치이다. 그렇기 때문에 prev가 현재 웅덩이의 시작위치보다 오른쪽이라면 prev에서부터 이어서 널빤지를 더 깔면 되고, 아니라면 현재 웅덩..
https://www.acmicpc.net/problem/21943 코드from itertools import combinationsn = int(input())x = list(map(int, input().split()))plus, mul = map(int, input().split())ans = 0def dfs(picked_cnt, remain_x, total): global ans if picked_cnt == 1: # 마지막 덩어리 ans = max(ans, total*sum(remain_x)) return # 하나의 덩어리 고르기 for i in range(1, len(remain_x)-picked_cnt+2): for comb in ..
딜레이레이
'문제풀이' 카테고리의 글 목록 (5 Page)