QOJ.ac

QOJ

Límite de tiempo: 6 s Límite de memoria: 256 MB Puntuación total: 100

#8692. 又一个卷积问题

Estadísticas

给定一个整数数组 $a_1, \dots, a_n$ 和一个整数数组 $b_1, \dots, b_n$。

你需要计算数组 $c_1, \dots, c_n$,其定义如下:

$$c_k = \max_{\gcd(i, j)=k} |a_i - b_j|$$

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 10^5$)。

第二行包含 $n$ 个整数 $a_1, \dots, a_n$ ($1 \le a_i \le 10^9$)。

第三行包含 $n$ 个整数 $b_1, \dots, b_n$ ($1 \le b_i \le 10^9$)。

输出格式

输出 $n$ 个整数 $c_1, \dots, c_n$。

样例

输入 1

8
1 2 3 4 5 6 7 8
8 7 6 5 4 3 2 1

输出 1

7 5 3 3 1 3 5 7

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#244EditorialOpen题解jiangly2025-12-13 00:29:40View

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.