
import syssys.setrecursionlimit(10**6)input = sys.stdin.readlinedef dfs(cur, cost): global visited currentLocation = graph[cur] currentType = currentLocation[0] nextLocation = list(map(int, currentLocation[2:-1])) if currentType == "L": cost = max(cost, int(currentLocation[1])) elif currentType == "T": cost -= int(currentLocation[1]) if cost 재귀도 다시 익혀야겠다 ..