- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
Latest commit
37 lines (31 loc) · 955 Bytes
/
Copy pathSolution.java
File metadata and controls
37 lines (31 loc) · 955 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
importjava.io.*;
importjava.util.*;
importjava.text.*;
importjava.math.*;
importjava.util.regex.*;
publicclassSolution {
publicstaticvoidmain(String[] args) {
Scannerin = newScanner(System.in);
List<List<Integer>> lines = newArrayList<List<Integer>>();
intn = in.nextInt();
for (inti = 0; i < n; i++) {
List<Integer> line = newArrayList<Integer>();
intd = in.nextInt();
for (intj = 0; j < d; j++) {
line.add(in.nextInt());
}
lines.add(line);
}
intq = in.nextInt();
for (inti = 0; i < q; i++) {
intx = in.nextInt();
inty = in.nextInt();
if (y > lines.get(x - 1).size()) {
System.out.println("ERROR!");
} else {
System.out.println(lines.get(x - 1).get(y - 1));
}
}
in.close();
}
}