from bisect import *
n,x = map(int, input().split())
arr = list(map(int, input().split()))
sussy2 = [0 for i in range(n)]
sussy = [0 for i in range(n)]
def LIS(lis):
dp = []
cur = n-1
for i in lis:
sus = bisect_left(dp,i)
if sus==len(dp):
dp.append(i)
else:
dp[sus] = i
sussy2[cur] = len(dp)
cur-=1
return len(dp)
def LIS2(lis):
dp = []
cur = 0
for i in lis:
sus = bisect_left(dp,i)
if sus==len(dp):
dp.append(i)
else:
dp[sus] = i
sussy[cur] = len(dp)
cur+=1
return len(dp)
LIS2(arr)
LIS([-i for i in arr])
ans = 0
for i in range(n-1):
ans = max(ans, sussy[i]+sussy2[i+1])
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
18160 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
18160 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
18160 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
178 ms |
46132 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
94 ms |
26404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
119 ms |
31096 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
18160 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |