시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 (추가 시간 없음) | 512 MB | 44 | 20 | 16 | 44.444% |
Your computer has a cache consisting of n different addresses, indexed from 1 to n. Each address can contain a single byte. Initially all cache bytes start off with the value zero.
You have m different pieces of data you want to store. Each piece of data is a byte array. The pieces of data may have different lengths, and any particular piece of data may be stored multiple times at different locations.
You are going to do q operations on your computer. There are three types of operations:
The first line of input contains three integers n, m and q (1 ≤ n, m, q ≤ 5 ∙ 105), where n is the size of the computer’s cache, m is the number of pieces of data, and q is the number of operations.
Each of the next m lines describes a piece of data, as a sequence of space separated integers. The first integer on the line, ki (1 ≤ ki, ∑ki ≤ 5 ∙ 105), indicates the number of integers to follow. Each of the next ki integers x (0 ≤ x ≤ 255) are the contents of the piece of data.
Each of the next q lines will have two, three, or four space-separated integers representing an operation, in order, as described above. Either:
1 i p or 2 p or 3 i l r
With (1 ≤ i ≤ m), (1 ≤ p ≤ n), and (1 ≤ l ≤ r ≤ ki). There is guaranteed to be at least one 2 operation.
For each 2 operation, output the integer value of cache location p, one per line.
5 2 10 3 255 0 15 4 1 2 1 3 2 1 1 2 2 1 1 1 2 1 2 4 3 1 1 2 2 1 1 1 2 2 2 2 5
0 255 1 255 0 3