• + 2 comments

    import java.io.; import java.util.;

    public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int N= sc.nextInt(); int q=sc.nextInt(); int lastAnswer=0; int x=1; int a[] [] = new int[q][3]; List> seqList = new ArrayList>(); for(int i=0;i

            }
    
            x=(a[i][1]^lastAnswer%N);
    
            if(a[i][0]==1)
            {           
                      seqList.add(new ArrayList<Integer>());
                      seqList.get(x).add(a[i][2]);               
            }
            else
            {   
                        int s = seqList.get(x).size() - 1;
                        lastAnswer =seqList.get(x).get(s);
                            if(lastAnswer!=0)
                        System.out.println(lastAnswer);            
            }
    
        }
        }
        }
        what is wrong with this code as it is giving only one positive test case?????