0分求助
查看原帖
0分求助
1189304
HUDSI1256楼主2024/1/21 11:22
#include <bits/stdc++.h>
using namespace std;
stack<int> k;bool flag=0;
signed main(){
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		int t,l,sum;cin>>t;
		for(int j=1;j<=t;j++){
			cin>>l;k.push(l);	
		}
		for(int j=1;j<=t;j++){
			cin>>l;sum=k.top();
			if(l!=sum){
				flag=1;cout<<"No"<<endl;break;
			}
			k.pop();
		}
		if(flag==0)cout<<"Yes"<<endl;
		flag=0;k.empty();
	}
	return 0;
}
2024/1/21 11:22
加载中...