feat: added alternative python solutions.

This commit is contained in:
2026-05-17 13:20:58 -03:00
parent 7e9caaea6e
commit c85571e157
451 changed files with 3777 additions and 3495 deletions

View File

@@ -43,7 +43,7 @@
},
"solutions": {
"main-ac": "ac.cpp",
"alternative-ac": [],
"alternative-ac": ["alternative-ac.py"],
"wrong-answer": [],
"time-limit": [],
"time-limit-or-ac": [],

View File

@@ -0,0 +1,25 @@
n = int(input())
a = list(map(int, input().split()))
dp = [1] * n
parent = [-1] * n
for i in range(n):
for j in range(i):
if a[j] < a[i] and dp[j] + 1 > dp[i]:
dp[i] = dp[j] + 1
parent[i] = j
max_length = max(dp)
max_index = dp.index(max_length)
lis = []
idx = max_index
while idx != -1:
lis.append(a[idx])
idx = parent[idx]
lis.reverse()
print(max_length)
print(' '.join(map(str, lis)))