提交时间:2023-11-25 11:27:35
运行 ID: 112284
# include <bits/stdc++.h> using namespace std ; long long a [114514] ; long long dp [114514] = { 0 , 1 } ; int main ( ) { long long mx = 0 ; long long x = 1 ; while ( cin >> a [x] ) { x ++ ; } long long s = 1 ; long long ms = 1 , me = 0 ; for ( long long i = 2 ; i <= x ; i ++ ) { if ( a [i] >= a [i - 1] ) { dp [i] = dp [i - 1] + 1 ; } else { if ( dp [i - 1] > mx ) { mx = dp [i - 1] ; ms = s ; me = i - 1 ; } dp [i] = 1 ; s = i ; } } cout << "max=" << mx << endl ; for ( long long i = ms ; i <= me ; i ++ ) { cout << a [i] << ' ' ; } return 0 ; }