fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int t, largestsum=0;
  5. cin >> t;
  6. for (int i = 0; i < t; i++) {
  7. int n, sum = 0, current =0, lastsum =0;
  8. cin >> n;
  9. for (int j = 0; j < n; j++) {
  10. int a; cin >> a;
  11. if (current <= a) {
  12. current = a;
  13. sum++;
  14. } else {
  15. lastsum = sum;
  16. current = a;
  17. sum = 1;
  18. }
  19. if (lastsum >= sum && largestsum < lastsum) {
  20. largestsum = lastsum;
  21. }
  22. else if (lastsum <= sum && largestsum < sum) {
  23. largestsum = sum;
  24. }
  25. }
  26. }
  27. cout << largestsum;
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0.01s 5324KB
stdin
1
6
1 2 1 4 5 4
stdout
3