30求救
查看原帖
30求救
1280199
zqh_7plus楼主2024/8/25 11:26
https://www.luogu.com.cn/record/174620662

如上这是我的评测结果,只有30分QAQ

这是我的代码,不知道错在哪里了

#include<bits/stdc++.h>
using namespace std;
const int p=1e5+1;
int s1[p],s2[p];
int top,a[p];
int main( ){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s1[i];
		s1[s1[i]]=i;
	}
	for(int i=1;i<=n;i++){
		cin>>s2[i];
		s2[i]=s1[s2[i]];
	}
	top=0;
	for(int i=1;i<=n;i++){
		if(s2[i]>a[top]){
			a[++top]=s2[i];
		}	
		else{
			a[lower_bound(a+1,a+top+1,s2[i])-a]=s2[i];
		}
	}
	cout<<top;
}

求大佬锐评

2024/8/25 11:26
加载中...