ice_fish01 @ 2023-03-03 23:26:45
我的代码:请求神犇支援qaq
#include<bits/stdc++.h>
using namespace std;
int a[100010],b[100000],n,q;
signed main()
{
stack <int> s;
cin >> q;
while(q--)
{
cin >> n;
for(int i = 1;i <= n;i++)
cin >> a[i];
for(int i = 1;i <= n;i++)
cin >> b[i];
int j = 1;
for(int i = 1;i <= n;i++)
{
s.push(a[i]);
if((s.top()) == b[j])
{
s.pop();
j++;
if(s.empty())
break;
}
}
if(s.empty())
puts("Yes");
else
puts("No");
while(!s.empty())
s.pop();
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
}
return 0;
}
by TheSky233 @ 2023-03-03 23:28:37
@ice_fish01
if((s.top()) == b[j])
while((s.top()) == b[j])
by ice_fish01 @ 2023-03-03 23:31:56
@TheSky233
by ice_fish01 @ 2023-03-03 23:33:24