diff --git a/c++/LIS.cpp b/c++/LIS.cpp new file mode 100644 index 0000000..bea3330 --- /dev/null +++ b/c++/LIS.cpp @@ -0,0 +1,38 @@ +#include +using namespace std; +#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); +#define ll long long +const ll MOD=1e9+7; + + + +void solve() +{ + fast; + ll n,sz = 0; + cin >> n; + vector a(n,0),b(n,0); + for(int i=0;i> a.at(i); + for(int i=0;ia.at(i) && b.at(i)+1>b.at(j)) + { + b.at(j) = b.at(i) + 1; + sz = max(sz,b.at(j)); + } + } + } + cout << sz + 1 << endl; +} + + +int main() +{ + fast; + + solve(); + + return 0; +} \ No newline at end of file