RE
查看原帖
RE
757214
Gohldg楼主2023/9/3 23:15
#include <bits/stdc++.h>
using namespace std;
int main(){
    int t,aa[114514],bb[114514],n,c[114514],xb;
    cin>>t;
    while(t--){
        stack<int>a;
        cin>>n,xb=1;
        for(int i=1;i<=n;i++)cin>>aa[i];
        for(int i=1;i<=n;i++)cin>>bb[i];
        for(int i=1;i<=n;i++){
            a.push(aa[i]);
            while(a.top()==bb[xb]&&!a.empty()){
                xb++,a.pop();
                if(xb>n)break;
            }
        }
        cout <<(!a.empty()?"No\n":"Yes\n");
    }
    return 0;
}
2023/9/3 23:15
加载中...