社区讨论
样例过了,但是是零分
P4387【深基15.习9】验证栈序列参与者 4已保存回复 7
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 7 条
- 当前快照
- 1 份
- 快照标识符
- @lo8mavkw
- 此快照首次捕获于
- 2023/10/27 20:56 2 年前
- 此快照最后确认于
- 2023/10/27 20:56 2 年前
rt
CPP还请大佬帮忙指出问题所在%%%
//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;
}
悬赏关注
回复
共 7 条回复,欢迎继续交流。
正在加载回复...