Problem list
Log in
#r03089 · Online Judge > GoldOJ

2D List Access

Bronze III 2.0 s 1024 MB

An $n \times m$ matrix is given, then $Q$ queries each r c (0-based). For each query print the value at row $r$, column $c$.

Input

Line 1: $n$ $m$. Next $n$ lines: the matrix. Then $Q$ and $Q$ queries r c.

Output

Print the queried value for each query, one per line.

Example 1

Input
3 4
1 2 3 4
5 6 7 8
9 10 11 12
4
0 0
1 2
2 3
2 0
Output
1
7
12
9
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code