liuhaopeng666 @ 2023-08-26 20:08:11
#include<iostream>
#include<stack>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
stack<int> s;
int n;
cin>>n;
int tot=1;
int a[100010],b[100010];
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
cin>>b[i];
}
for(int i=1;i<=n;i++){
s.push(a[i]);
while(b[ ]==s.top()){
s.pop();
if(s.empty()) break;
}
}
if(s.empty()) cout<<"Yes"<<endl;
else{
cout<<"No"<<endl;
}
}
return 0;
}
by OldDriverTree @ 2023-09-14 19:53:51
@liuhaopeng666 b[]
?