-
카테고리
-
세부 분야
알고리즘 · 자료구조
-
해결 여부
미해결
반례를 못찾겠습니다 ㅠㅠ
21.01.25 15:26 작성 조회수 86
0
mport sys
input = sys.stdin.readline
def sol():
global maxN
n = int(input())
table = []
maxN = -1e9
for i in range(n):
a,b = map(int,input().split())
table.append((i+1,a,b))
def dfs(s, tot):
global maxN
if tot > maxN:
maxN = tot
for i in range(s, n):
if s == 0:
dfs(i+1, tot+table[i][2])
elif table[s-1][0] + table[s-1][1] <= table[i][0]:
dfs(i+1, tot+table[i][2])
dfs(0, 0)
print(maxN)
sol()
4번 케이스에서 오류가 나는데 반례를 찾지 못하겠습니다 ㅠㅠ
강의 항상 잘 보고있습니다!
답변을 작성해보세요.
0
답변 1