样例过了,但是是零分
查看原帖
样例过了,但是是零分
661595
a2lyaXNhbWUgbWFyaXNh楼主2022/7/12 11:15

rt

还请大佬帮忙指出问题所在%%%

//P4387
#include<bits/stdc++.h>
using namespace std;
int main() {
	int q,n;
	bool f=1;
	stack<int>p;
	cin>>q;
	while(q--) {
		cin>>n;
		int a[n],b[n];
		for(int i=0; i<n; i++)
			cin>>a[i];
		for(int i=0; i<n; i++)
			cin>>b[i];
		for(int i=0; i<n; i++)
			p.push(a[i]);
		for(int i=0;i<n;i++){
			if(p.top()!=b[i]){
				f=0;
				break;
			}
			p.pop();
		}
		if(f)cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;
}

悬赏关注

2022/7/12 11:15
加载中...