求助,自己测感觉没问题,提交就一片红
查看原帖
求助,自己测感觉没问题,提交就一片红
1029471
zaobei楼主2023/12/16 15:42
import java.util.*;

import static java.lang.Math.pow;

public class Main {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        Stack<Integer> stack=new Stack<>();
        int n=scan.nextInt();

        for(int i=0;i<n;i++){
            int z=0;
            int k=scan.nextInt();

            for(int j=0;j<k;j++){
            stack.push(scan.nextInt());
            }
            for(int j=0;j<k;j++){
                int y=scan.nextInt();
                if(y!=stack.pop()){
                    z=1;
                }
            }

            if(z==0)System.out.println("Yes");
            else System.out.println("No");
            stack.clear();
        }

    }
                                  }
2023/12/16 15:42
加载中...