You are viewing a single comment's thread. Return to all comments →
****Scanner sc =new Scanner(System.in); ArrayList<ArrayList<Integer>>arr= new ArrayList<ArrayList<Integer>>(); int n= sc.nextInt(); for(int i=0; i<n; i++){ arr.add(new ArrayList<Integer>()); int d= sc.nextInt(); for(int j=0; j<d; j++){ arr.get(i).add(sc.nextInt()); } } int q= sc.nextInt(); for(int k=0; k<q; k++){ int x=sc.nextInt(); int y=sc.nextInt(); try{ System.out.println(arr.get(x-1).get(y-1)); }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 →