forked from codehouseindia/Java-Programs
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathJava Array list.java
More file actions
32 lines (26 loc) · 759 Bytes
/
Java Array list.java
File metadata and controls
32 lines (26 loc) · 759 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
31
32
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int l = sc.nextInt();
ArrayList [ ] list = new ArrayList[l];
for(int i = 0; i < l; i ++) {
int n = sc.nextInt();
list[i] = new ArrayList();
while(n -- > 0) {
list[i].add(sc.nextInt());
}
}
int q = sc.nextInt();
while(q -- > 0) {
int x = sc.nextInt();
int y = sc.nextInt();
try {
System.out.println(list[x - 1].get(y - 1));
} catch (Exception e) {
System.out.println("ERROR!");
}
}
}
}