#abc271b. B - Maintain Multiple Sequences
B - Maintain Multiple Sequences
Score : points
问题描述
存在 个整数序列。
第 个 序列包含 项;第 个序列的第 项 为 。
你将获得 个查询请求。对于第 个 查询,给定整数 和 ,找出第 个序列的第 项。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are sequences of integers.
The -th sequence has terms; the -th term of the -th sequence is .
You are given queries. For the -th query, given integers and , find the -th term of the -th sequence.
Constraints
- $1 \leq a_{i, j} \leq 10^9 \, (1 \leq i \leq N, 1 \leq j \leq L_i)$
- $1 \leq s_k \leq N, 1 \leq t_k \leq L_{s_k} \, (1 \leq k \leq Q)$
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer to the -th query.
Sample Input 1
2 2
3 1 4 7
2 5 9
1 3
2 1
Sample Output 1
7
5
The -st sequence is and the -nd is .
The answer to each query is as follows:
- The -rd term of the -st sequence is .
- The -st term of the -nd sequence is .
Sample Input 2
3 4
4 128 741 239 901
2 1 1
3 314 159 26535
1 1
2 2
3 3
1 4
Sample Output 2
128
1
26535
901
update @ 2024/3/10 11:25:07