#include<bits/stdc++.h>
#define stm st.empty()
using namespace std;
stack<int> st;
int q,n,x,a[100005],b[100005],popg;
signed main(){
cin.tie(0)->sync_with_stdio(0);
cin >> q;
while(q--){
cin >> n;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
stack<int> st;
for(int i = 1;i <= n;++i) cin >> a[i];
for(int i = 1;i <= n;++i) cin >> b[i];
popg = 1;
for(int i = 1;popg <= n;++i){
if(i <= n) st.push(a[i]);
if(st.top() == b[popg]){
st.pop();
popg++;
}else{
if(i > n) cout << "No" << endl;
return 0;
}
}
if(stm){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
}
cout << flush;
system("pause");
return 0;
}
我只想知道我错哪了,不想要代码,回复记得@我一下,谢谢