Submission #632802

# Submission time Handle Problem Language Result Execution time Memory
632802 2022-08-20T20:24:43 Z beaconmc Global Warming (CEOI18_glo) PyPy 3
0 / 100
199 ms 44068 KB
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])
print(ans)
# Verdict Execution time Memory Grader output
1 Correct 34 ms 18220 KB Output is correct
2 Incorrect 35 ms 18120 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 18220 KB Output is correct
2 Incorrect 35 ms 18120 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 18220 KB Output is correct
2 Incorrect 35 ms 18120 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 199 ms 44068 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 25864 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 118 ms 30124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 18220 KB Output is correct
2 Incorrect 35 ms 18120 KB Output isn't correct
3 Halted 0 ms 0 KB -