当前位置:网站首页>【 ssl2 ⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶83
【 ssl2 ⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶83
2022-06-13 09:35:00 【Ayane.】

analysis :
Longest common subsequence u p p e r _ b o u n d upper\_bound upper_bound Just find a place
CODE:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define reg register
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n,id[N],a[N],f[N],ans;
int main(){
scanf("%d",&n);
for(int i=1,x;i<=n;i++)
{
scanf("%d",&x);
id[x]=i;
}
for(int i=1,x;i<=n;i++)
{
scanf("%d",&x);
a[i]=id[x];
}
f[++ans]=a[1];
for(int i=2;i<=n;i++)
{
if(a[i]>f[ans]) f[++ans]=a[i];
else
{
int p=upper_bound(f+1,f+ans+1,a[i])-f;
f[p]=a[i];
}
}
printf("%d",ans);
return 0;
}
边栏推荐
- (dp+ memory) acwing 901 skiing
- Tree and binary tree: storage structure of binary tree
- Queue and stack
- VDD, dvdd, avdd, VCC, afvdd, dovdd, iovdd
- acwing 788. Number of pairs in reverse order
- BGP 联邦+Community
- LeetCode 583. 两个字符串的删除操作
- Classes and objects -- Inheritance
- LeetCode 6096. Success logarithm of spells and potions (binary search)
- (state compression dp+good) acwing 291 Mondrian's dream
猜你喜欢

阿里高级专家剖析 | Protocol的标准设计

Classes and objects -- polymorphic

Final principle
![[implementation of depth first search]](/img/10/4f150e4fa0d4edf01483a72b881afe.jpg)
[implementation of depth first search]

acwing 789. Range of numbers (dichotomy + suitable for understanding dichotomy boundary)

【pytorch环境安装搭建】

Exporting MySQL data table documents using Navicat

(tree DP) acwing 285 A dance without a boss

(Dijkstra + shortest circuit + by point n^2) acwing 849 Dijkstra finding the shortest path I

Storage mode of drawings
随机推荐
Classes and objects -- Inheritance
Can the operation of the new BMW I3 meet the expectations of the famous products of the 3 series?
Instruction level parallelism (?)
LeetCode 剑指 Offer 30. 包含min函数的栈
Zigzag transformation
Remember! Don't be too confident in writing code! Be sure to write some key log info output, or the problem will not be located.
(dfs+ pruning + checkerboard problem +dood) acwing 843 N-queen problem
Yolov5 model evaluation
IP address introduction
C # introductory series (XIII) -- getting to know the structure for the first time
LeetCode 6097. 替换字符后匹配(字典)
BGP Federation +community
Tree and binary tree: operation and storage structure of tree
Immutability of shared model
@Value does not take effect and extend/implement other classes cannot inject beans manually
(state compression dp+ binary) acwing 91 Shortest Hamilton path
Dynamic display of analog clock using digital clock in turtle Library
Use typescript to complete simple snake eating function
(dp+ memory) acwing 901 skiing
acwing 788. Number of pairs in reverse order