#P1439. 两个排列的最长公共子序列
两个排列的最长公共子序列
Description
Given two permutations and of , find their longest common subsequence.
Input Format
The first line contains an integer . Each of the next two lines contains integers forming a permutation of .
Output Format
A single integer, the length of the longest common subsequence.
5
3 2 1 4 5
1 2 3 4 5
3
Hint
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号