Flower_Bloom @ 2023-01-12 11:21:02
#include <bits/stdc++.h>
using namespace std;
int sta[100005],staout[100005];
int topp;
stack <int> stackk;
int main()
{
int n,l;
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>l;
for (int j=1;j<=l;j++)
{
cin>>sta[j];
}
for (int j=1;j<=l;j++)
{
cin>>staout[j];
}
topp=1;
for (int j=1;j<=l;j++)
{
stackk.push(sta[j]);
while (stackk.top()==staout[topp])
{
stackk.pop();
topp++;
if (stackk.empty())
{
break;
}
}
}
if (stackk.empty())
cout<<"YES"<<'\n';
else
cout<<"NO"<<'\n';
while (!stackk.empty())
stackk.pop();
}
system("pause");
return 0;
}
样例过了,大佬帮我看看!
by chaynflow @ 2023-01-12 11:28:08
认真读题,是YES
还是Yes
,NO
还是No
?
然后把system
去了。
by Flower_Bloom @ 2023-01-12 11:30:12
哦哦,谢谢(我用的Vscode)
by Flower_Bloom @ 2023-01-12 11:30:26
@chy2011