개발자 톡

연습문제 톡 징검다리

뭐가 문제라 오답이 나오는 걸까요?

등록일
2023-12-12 17:07:36
조회수
498
작성자
wlswjdwwkd
import sys

n = int(input())

a = list(map(int, input().split()))

dpL = [1]*n

for i in range(1, n):
  tmpL = []
  for j in range(i):
    if a[i] > a[j]:
      tmpL.append((j, a[j]))
  if(len(tmpL) != 0):
    sortedL = sorted(tmpL, key = lambda x : x[1], reverse = True)
    dpL[i] = dpL[i] + dpL[sortedL[0][0]]

print(max(dpL))


#징검다리

이 카테고리의 톡 더보기