codeup 4652 code example
Example: codeup 4652
#include <cstdio>
int n, m[100005], r = 1, t = 1, l = 1;
int main() {
scanf("%d", &n);
for(int i = 0; i < n; i++) {
scanf("%d", &m[i]);
if(i < 1) continue;
if(m[i - 1] <= m[i])
t++;
else t = 1;
if(m[i - 1] >= m[i])
l++;
else l = 1;
if(t > r) r = t;
if(l > r) r = l;
}
printf("%d", r);
}