最大公因数(gcd)
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
给定两个长度为 的排列 和 。有 个询问,每个询问给出 ,输出:
答案对 取模。
输入格式
第一行两个正整数表示 。
接下来两行,每行 个正整数表示 。
接下来 行,每行四个正整数表示 。
输出格式
行,每行一个正整数表示答案。
样例
【样例输入】
5 5
4 1 5 3 2
1 2 3 4 5
3 3 2 3
3 4 2 4
3 4 3 4
5 5 1 1
1 1 2 2
【样例输出】
2
14
12
1
4
数据范围
测试点编号 | 特殊性质 | |
---|---|---|
NOIP 模拟赛(十一)
- Status
- Done
- Rule
- OI
- Problem
- 4
- Start at
- 2024-11-20 7:45
- End at
- 2024-11-20 12:15
- Duration
- 4.5 hour(s)
- Host
- Partic.
- 17