Problem list
Log in
#r03091 · Online Judge > GoldOJ

Find a Value in a Matrix

Bronze II 2.0 s 1024 MB

An $n \times m$ matrix of distinct integers is given, then $Q$ queries, each a value $x$ guaranteed to be present. For each query print the position of $x$ as row col (0-based).

Input

Line 1: $n$ $m$. Next $n$ lines: the matrix. Then $Q$ and $Q$ values.

Output

Print the row col of each queried value, one per line.

Example 1

Input
3 4
10 20 30 40
50 60 70 80
90 100 110 120
3
70
10
120
Output
1 2
0 0
2 3
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