LIS is about subsequences, not subarrays.
If you want to solve the problem using subarrays, you can refer to this link: https://codeforces.me/problemset/problem/702/A
The LIS algorithm does not work for finding the longest increasing subarray.
The provided code implements the LIS algorithm.
This problem (https://codeforces.me/problemset/problem/264/B) is a good example of the LIS problem.
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, start, end) for (int i = start; i < end; i++)
#define all(x) x.begin(), x.end()
//------------------------------vector-----------------------------------
template <typename T>
inline void INTPUT_V(vector<T> &v) { rep(i, 0, v.size()) cin >> v[i]; }
// --------------------------------------------------------------------------
#define MOD 1000000007
//#include "MyDebuger.cpp"
void solve()
{
int n;
cin >> n;
vi numbers(n, 0);
INTPUT_V(numbers);
vector<int> dp(n, 0);
rep(i, 0, n)
{
rep(j, 0, i)
{
if (numbers[j] < numbers[i] && dp[i] < dp[j] + 1)
{
dp[i] = dp[j] + 1;
}
}
}
//debug(dp);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
// cout.tie(0);
int t = 1;
// cin >> t;
rep(i, 0, t)
{
solve();
}
return 0;
}
Your code is $$$O(n^2)$$$ but LIS can be done in $$$O(n\log{n})$$$ as shown here