-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathArrayLists.java
More file actions
30 lines (28 loc) · 921 Bytes
/
ArrayLists.java
File metadata and controls
30 lines (28 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.io.*;
import java.util.*;
public class ArrayLists {
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 in = new Scanner(System.in);
int n,m,x,y;
ArrayList<ArrayList<Integer>> l = new ArrayList<>();
n = in.nextInt();
for(int i = 0; i < n; i++){
ArrayList<Integer> l1 = new ArrayList<>();
m = in.nextInt();
for(int j = 0; j < m; j++)
l1.add(in.nextInt());
l.add(l1);
}
n = in.nextInt();
for(int i = 0; i < n; i++){
x = in.nextInt();
y = in.nextInt();
try{
System.out.println(l.get(x-1).get(y-1));
}catch(Exception e){
System.out.println("ERROR!");
}
}
}
}