-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_Java Arraylist.java
More file actions
37 lines (35 loc) · 927 Bytes
/
Copy path03_Java Arraylist.java
File metadata and controls
37 lines (35 loc) · 927 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
33
34
35
36
37
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
int c=s.nextInt();
ArrayList<ArrayList<Integer>> arr = new ArrayList<>(c);
for(int i=0;i<c;i++)
{
int c2=s.nextInt();
ArrayList<Integer> temp = new ArrayList<>(c2);
for(int j=0;j<c2;j++)
temp.add(s.nextInt());
arr.add(temp);
}
int c3=s.nextInt();
for(int i=0;i<c3;i++)
{
int x=s.nextInt();
int y=s.nextInt();
try
{
System.out.println(arr.get(x-1).get(y-1));
}
catch(IndexOutOfBoundsException e)
{
System.out.println("ERROR!");
}
}
}
}