We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicclassSolution{publicstaticvoidmain(String[]args){/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */Scannersc=newScanner(System.in);introw=Integer.parseInt(sc.next());sc.nextLine();List<List<Integer>>input=IntStream.range(0,row).mapToObj(unused->{returnArrays.stream(sc.nextLine().trim().split(" ")).skip(1).map(Integer::parseInt).collect(Collectors.toList());}).collect(Collectors.toList());row=sc.nextInt();IntStream.range(0,row).forEach(unused->{intx=sc.nextInt()-1;inty=sc.nextInt()-1;if(x<input.size()&&y<input.get(x).size())System.out.println(input.get(x).get(y));elseSystem.out.println("ERROR!");});sc.close();}
Cookie support is required to access HackerRank
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 →