#include #include #include using namespace std; vector LIS(const vector& v){ vector res(v.size(), 1); vector a(v.size(), v[0]); auto end = a.begin(); ++end; int size = 0; for(int i=1;i& a){ auto f = LIS(a); reverse(a.begin(), a.end()); auto g = LIS(a); int res = 0; for(int i=0;i> N){ vector A(N), B(N); for(int i=0;i> A[i]; B[i] = -A[i]; } cout << max(solve(A), solve(B)) << endl; } }