提交时间:2023-11-25 11:21:04
运行 ID: 112267
# include <bits/stdc++.h> using namespace std ; int a [114514] ; int dp [114514] = { 0 , 1 } ; int main ( ) { int mx = 0 ; int x = 1 ; while ( cin >> a [x] ) { x ++ ; } int s = 1 ; int ms = 1 , me = 0 ; for ( int 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 << mx << endl ; for ( int i = ms ; i <= me ; i ++ ) { cout << a [i] << ' ' ; } return 0 ; }