

Predicated upon the dual conditions of your nativity occurring in the chronological bounds of 2008, concurrently coupled with your geographical domicile within the sovereign territory of Vietnam, I harbor the steadfast conviction that you are endowed with the requisite cognitive faculties to successfully unravel this particular conundrum (LOL hahahaha)
Longest Increasing Subsequence
Problem Statement
You are given an array of N integers: `A[1], A[2], ..., A[N]`
A subsequence is considered strictly increasing if it can be formed by selecting elements such that `A[i_1] < A[i_2] < ... < A[i_k]`, where their original indices satisfy `i_1 < i_2 < ... < i_k`.
Task:
Determine the length of the longest strictly increasing subsequence of the given array.
Input Format
* The first line contains a single integer `N (1 <= N <= 30000)`, representing the size of the array.
* The second line contains N space-separated integers `A[1], A[2], ..., A[N] (0 <= A[i] <= 1000000)`.
Output Format
* Print a single integer representing the maximum length of the increasing subsequence.
Example:
Input:
6
1 2 5 4 6 2
Output:
4
The scope of admissible development tools is strictly restricted to the following programming languages: C, Objective-C, Haskell, OCaml, and Pascal.
Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
Pascal :
uses math;
const
k = 30000;
var
n, i, l, p: longint;
a,t: array[1..k] of longint;
function binarysearch(x, y, z: longint): longint;
var
m, s: longint;
begin
s:=z + 1;
while y<=z do
begin
m:=y + (z - y) div 2;
if t[m]>=x then
begin
s:=m;
z:=m-1;
end
else
y:=m+1;
end;
exit(s);
end;
begin
readln(n);
for i:=1 to n do
read(a[i]);
l:=0;
for i:=1 to n do
begin
p:=binarysearch(a[i],1,l);
t[p]:=a[i];
if p>l then
l:=p;
end;
writeln(l);
end.
#HaolacHãy giúp mọi người biết câu trả lời này thế nào?

`\color{black}{#Jadess౨ৎ}`
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n), d;
for (int i = 0; i < n; i++) {
cin >> a[i];
auto it = lower_bound(d.begin(), d.end(), a[i]);
if (it == d.end()) d.push_back(a[i]);
else *it = a[i];
}
cout << d.size();
}
`\color{#1AD5F7}{꧁⋆⟡T}\color{#1AD5F7}{D}\color{#4DA6E6}{u}\color{#668EDD}{n}\color{#8077D5}{g}\color{#B28DFF}{\ }\color{#995FCD}{G}\color{#EA2F90}{M⟡⋆꧂}`
Hãy giúp mọi người biết câu trả lời này thế nào?

Bảng tin
5618
5177
3505
Thiết nghĩ bạn cũng là user cày top bên box Tin học mà tại sao dùng # cho chú thích nhỉ? Không biết bạn cố ý để người khác biết code của bạn có sự hỗ trợ 1% từ bạn hay để làm gì nhệ? Cũng không rõ bạn hiểu được đề bao nhiêu % mà giải nhanh ấy nhỉ? Thế tớ xin 1 câu giải thích bằng Tiếng Anh cách bạn làm thử xem như nào? Rút gọnThiết nghĩ bạn cũng là user cày top bên box Tin học mà tại sao dùng # cho chú thích nhỉ? Không biết bạn cố ý để người khác biết code của bạn có sự hỗ trợ 1% từ bạn hay để làm gì nhệ? Cũng không rõ bạn hiểu được đề bao nhiêu % mà giải nhanh ấy nhỉ? Thế ... xem thêm
196
2073
73
dốt TA lắm