You are viewing a single comment's thread. Return to all comments →
` public static void main(String[] args) { Scanner sc=new Scanner(System.in); ArrayList<ArrayList<Integer>> al=new ArrayList<>(); int n=sc.nextInt(); for(int i=0;i<n;i++){ int q=sc.nextInt(); ArrayList<Integer> temp=new ArrayList<>(); int x=0; while(x<q){ temp.add(sc.nextInt()); x++; } al.add(temp); } int q=sc.nextInt(); for(int i=0;i<q;i++){ int r=sc.nextInt(); int c=sc.nextInt(); try{ int ele=al.get(r-1).get(c-1); System.out.println(ele); } catch(Exception e){ System.out.println("ERROR!"); } } }
`
Seems like cookies are disabled on this browser, please enable them to open this website
Java Arraylist
You are viewing a single comment's thread. Return to all comments →
`