#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int longestIncreasingSubsequence(vector<double>& b) {
int n = b.size();
vector<int> dp(n, 1);
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) {
if (b[j] < b[i]) {
dp[i] = max(dp[i], dp[j] + 1);
}
}
}
int maxLength = 0;
for (int i = 0; i < n; i++) {
maxLength = max(maxLength, dp[i]);
}
return maxLength;
}
int main() {
vector<double> b = {1.3, 2.1, 9.1, 4.3};
int length = longestIncreasingSubsequence(b);
cout << length << endl; // Kết quả: 4
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGxvbmdlc3RJbmNyZWFzaW5nU3Vic2VxdWVuY2UodmVjdG9yPGRvdWJsZT4mIGIpIHsKICAgIGludCBuID0gYi5zaXplKCk7CiAgICB2ZWN0b3I8aW50PiBkcChuLCAxKTsKCiAgICBmb3IgKGludCBpID0gMTsgaSA8IG47IGkrKykgewogICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgaTsgaisrKSB7CiAgICAgICAgICAgIGlmIChiW2pdIDwgYltpXSkgewogICAgICAgICAgICAgICAgZHBbaV0gPSBtYXgoZHBbaV0sIGRwW2pdICsgMSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgaW50IG1heExlbmd0aCA9IDA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIG1heExlbmd0aCA9IG1heChtYXhMZW5ndGgsIGRwW2ldKTsKICAgIH0KCiAgICByZXR1cm4gbWF4TGVuZ3RoOwp9CgppbnQgbWFpbigpIHsKICAgIHZlY3Rvcjxkb3VibGU+IGIgPSB7MS4zLCAyLjEsIDkuMSwgNC4zfTsKICAgIGludCBsZW5ndGggPSBsb25nZXN0SW5jcmVhc2luZ1N1YnNlcXVlbmNlKGIpOwogICAgY291dCA8PCBsZW5ndGggPDwgZW5kbDsgIC8vIEvhur90IHF14bqjOiA0CgogICAgcmV0dXJuIDA7Cn0=