fanzhiheng1234 @ 2022-07-16 17:51:32
#include<bits/stdc++.h>
using namespace std;
int t,n;
stack<int>q;
int main(){
cin>>t;
for(int i=1;i<=t;i++){
int num=1;
int a[100001],b[100010];
cin>>n;
for(int j=1;j<=n;j++){
cin>>a[j];
}
for(int j=1;j<=n;j++){
cin>>b[j];
}
for(int j=1;j<=n;j++){
q.push(a[j]);
while(q.top()==b[num]){
q.pop();
num++;
if(q.empty())break;
}
}
if(q.empty()){
cout<<"Yes";
}else{
cout<<"No";
}
while(!q.empty()){
q.pop();
}
}
return 0;
}
by Discovery_Bright @ 2022-07-18 16:15:48
我也是啊
by crazy__sheep @ 2022-07-18 19:39:31
@fanzhiheng1234 换行呢???
by fanzhiheng1234 @ 2022-07-19 13:59:48
谢谢大佬,现在AC了
by crazy__sheep @ 2022-07-21 14:37:12
话说第一次我也没加换行(逃