ycyxh1 @ 2024-07-08 16:50:07
#include<bits/stdc++.h>
using namespace std;
int p1[100001],p2[100001];
int a[100001];
int n,tot=0;
int work(int x){
int l=1,r=tot,ans;
while(l<=r){
int mid=l+r>>1;
if(a[mid]>x){
r=mid-1;
ans=mid;
}
else{
l=mid+1;
ans=mid+1;
}
}
return ans;
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&p1[i]);
}
for(int i=1;i<=n;i++){
scanf("%d",&p2[p1[i]]);
}
for(int i=1;i<=n;i++){
if(p2[i]>a[tot]){
a[++tot]=p2[i];
}
else{
a[work(p2[i])]=p2[i];
}
}
printf("%d",tot);
return 0;
}
by ChampionCyan @ 2024-07-08 17:04:29
你我还是第一此回复呢,上几次“恶意回复”还是回复 @ycy1124
by ycyxh1 @ 2024-07-08 17:07:03
@ChampionCyan
我无语了