Submission #548426

#TimeUsernameProblemLanguageResultExecution timeMemory
548426arstalchanGlobal Warming (NOI13_gw)Cpython 3
19 / 40
1085 ms39836 KiB
L = [int(input()) for x in range(int(input()))] L.insert(0, -1) L.append(-1) ans = 0 cur = 0 values = {} for x in range(1, len(L) - 1): if L[x] == L[x-1] and L[x-1] != -1: L[x-1] = L[x-2] if L[x-1] < L[x] > L[x+1]: if L[x] in values: values[L[x]] += 1 else: values[L[x]] = 1 if L[x-1] > L[x] < L[x+1]: if L[x] in values: values[L[x]] -= 1 else: values[L[x]] = -1 for x in sorted(values)[::-1]: cur += values[x] ans = max(ans, cur) print(ans)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...