lizhuorong @ 2024-07-08 13:33:57
#include<bits/stdc++.h>
using namespace std;
long long a[500005],b[500005];
map<long long,long long>m;
int main(){
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=m;i++){
cin>>b[i];
m[b[i]]=1;
}
int flag=1;
long long ans=0;
for(int i=1;i<=n;i++){
if(m[a[i]]) flag=1;
else{
if(flag==1) ans++,flag=0;
}
}
cout<<ans;
}
by yangxikun @ 2024-07-08 13:54:17
@lizhuorong int和map重名了
by stylus @ 2024-07-08 14:28:43
@lizhuorong
map<long long,long long>m;
|
\/
int n,m;
2m?
by lizhuorong @ 2024-07-09 08:15:49
@yangxikun 谢谢,已过