Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
86968 sh25_zhangyy 花匠(Day 2) Python3 Accepted 81 MS 16564 KB 309 2026-04-10 14:54:41

Tests(10/10):


n = int(input()) h = list(map(int, input().split())) if n <= 1: print(n) else: up = 1 down = 1 for i in range(1, n): if h[i] > h[i-1]: up = down + 1 elif h[i] < h[i-1]: down = up + 1 # if equal, do nothing print(max(up, down))


Judgement Protocol: