alphacademy-cpp/quito/Kefa.cpp

30 lines
527 B
C++
Raw Normal View History

2023-01-18 21:26:31 +00:00
#include <bits/stdc++.h>
using namespace std;
int main () {
int n;
cin >> n;
2023-01-20 14:46:04 +00:00
vector<int> v(n);
2023-01-18 21:26:31 +00:00
for (int i = 0; i < n; i++) {
2023-01-20 14:46:04 +00:00
cin >> v[i];
2023-01-18 21:26:31 +00:00
}
2023-01-20 14:46:04 +00:00
int streak = 1;
int maxstreak = 1;
for (int i = 1; i<n ;i++) {
if (v[i-1] <= v[i]) {
streak++;
} else {
if (streak>maxstreak) {
maxstreak = streak;
2023-01-18 21:26:31 +00:00
}
2023-01-20 14:46:04 +00:00
streak = 1;
2023-01-18 21:26:31 +00:00
}
}
2023-01-20 14:46:04 +00:00
if (streak>maxstreak) {
2023-01-18 21:26:31 +00:00
maxstreak = streak;
}
2023-01-20 14:46:04 +00:00
2023-01-18 21:26:31 +00:00
cout<<maxstreak;
}