마지막 테스트 케이스만 오답
import sys
from itertools import permutations
input = sys.stdin.readline
n, m = map(int, input().rstrip().split())
M = [list(map(int, input().rstrip().split())) for _ in range(n)]
positions = [list(map(int, input().rstrip().split())) for _ in range(m)]
ans = 0
def dfs(x, y, used, res, cnt):
used.add((x,y))
if cnt == 0: return (used, res+M[x][y])
u0, r0 = dfs(x-1, y, used.copy(), res+M[x][y], cnt-1) if 0<=x-1<n and 0<=y<n and (x-1, y) not in used else (set(), 0)
u1...
- 연습문제 톡
- 날짜
- 2025-01-31 20:53:21
- 작성자
- dontakeman
- 댓글
- 0