CF1876B.Effects of Anti Pimples

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Chaneka has an array [a1,a2,…,an][a_1,a_2,\ldots,a_n]. Initially, all elements are white. Chaneka will choose one or more different indices and colour the elements at those chosen indices black. Then, she will choose all white elements whose indices are multiples of the index of at least one black element and colour those elements green. After that, her score is the maximum value of aia_i out of all black and green elements.

There are 2n−12^n-1 ways for Chaneka to choose the black indices. Find the sum of scores for all possible ways Chaneka can choose the black indices. Since the answer can be very big, print the answer modulo 998 244 353998\,244\,353.

Chaneka 有一个数组 [a1,a2,…,an][a_1,a_2,\ldots,a_n]。初始时,所有元素均为白色。Chaneka 将选择一个或多个互不相同的下标,并将这些下标对应位置的元素染成黑色。接着,她将找出所有满足以下条件的白色元素:其下标是至少一个黑色元素下标的倍数,并将这些元素染成绿色。此后,她的得分为所有黑色和绿色元素中 aia_i 的最大值。

Chaneka 选择黑色下标的方式共有 2n−12^n-1 种。求对所有可能的黑色下标选择方式,其对应得分的总和。由于答案可能非常大,请将结果对 998 244 353998\,244\,353 取模后输出。

输入格式

The first line contains a single integer nn (1≤n≤1051 \leq n \leq 10^5) — the size of array aa.

The second line contains nn integers a1,a2,a3,…,ana_1,a_2,a_3,\ldots,a_n (0≤ai≤1050\leq a_i\leq10^5).

第一行包含一个整数 nn(1≤n≤1051 \leq n \leq 10^5)—— 数组 aa 的大小。

第二行包含 nn 个整数 a1,a2,a3,…,ana_1,a_2,a_3,\ldots,a_n(0≤ai≤1050\leq a_i\leq10^5)。

输出格式

An integer representing the sum of scores for all possible ways Chaneka can choose the black indices, modulo 998 244 353998\,244\,353.

一个整数,表示 Chaneka 选择所有可能的黑色下标方案所得分数之和,对 998 244 353998\,244\,353 取模的结果。

输入输出样例

  • 输入#1

    4
    19 14 19 9

    输出#1

    265
  • 输入#2

    1
    0

    输出#2

    0
  • 输入#3

    15
    90000 9000 99000 900 90900 9900 99900 90 90090 9090 99090 990 90990 9990 99990

    输出#3

    266012571

说明/提示

In the first example, below are the 1515 possible ways to choose the black indices:

  • Index 11 is black. Indices 22, 33, and 44 are green. Maximum value among them is 1919.
  • Index 22 is black. Index 44 is green. Maximum value among them is 1414.
  • Index 33 is black. Maximum value among them is 1919.
  • Index 44 is black. Maximum value among them is 99.
  • Indices 11 and 22 are black. Indices 33 and 44 are green. Maximum value among them is 1919.
  • Indices 11 and 33 are black. Indices 22 and 44 are green. Maximum value among them is 1919.
  • Indices 11 and 44 are black. Indices 22 and 33 are green. Maximum value among them is 1919.
  • Indices 22 and 33 are black. Index 44 is green. Maximum value among them is 1919.
  • Indices 22 and 44 are black. Maximum value among them is 1414.
  • Indices 33 and 44 are black. Maximum value among them is 1919.
  • Indices 11, 22, and 33 are black. Index 44 is green. Maximum value among them is 1919.
  • Indices 11, 22, and 44 are black. Index 33 is green. Maximum value among them is 1919.
  • Indices 11, 33, and 44 are black. Index 22 is green. Maximum value among them is 1919.
  • Indices 22, 33, and 44 are black. Maximum value among them is 1919.
  • Indices 11, 22, 33, and 44 are black. Maximum value among them is 1919.

The total sum is 19+14+19+9+19+19+19+19+14+19+19+19+19+19+19=26519+14+19+9+19+19+19+19+14+19+19+19+19+19+19 = 265.

在第一个样例中,以下是选择黑色下标的 1515 种可能方式:

  • 下标 11 为黑色,下标 22、33 和 44 为绿色,其中最大值为 1919。
  • 下标 22 为黑色,下标 44 为绿色,其中最大值为 1414。
  • 下标 33 为黑色,其中最大值为 1919。
  • 下标 44 为黑色,其中最大值为 99。
  • 下标 11 和 22 为黑色,下标 33 和 44 为绿色,其中最大值为 1919。
  • 下标 11 和 33 为黑色,下标 22 和 44 为绿色,其中最大值为 1919。
  • 下标 11 和 44 为黑色,下标 22 和 33 为绿色,其中最大值为 1919。
  • 下标 22 和 33 为黑色,下标 44 为绿色,其中最大值为 1919。
  • 下标 22 和 44 为黑色,其中最大值为 1414。
  • 下标 33 和 44 为黑色,其中最大值为 1919。
  • 下标 11、22 和 33 为黑色,下标 44 为绿色,其中最大值为 1919。
  • 下标 11、22 和 44 为黑色,下标 33 为绿色,其中最大值为 1919。
  • 下标 11、33 和 44 为黑色,下标 22 为绿色,其中最大值为 1919。
  • 下标 22、33 和 44 为黑色,其中最大值为 1919。
  • 下标 11、22、33 和 44 均为黑色,其中最大值为 1919。

总和为 19+14+19+9+19+19+19+19+14+19+19+19+19+19+19=26519+14+19+9+19+19+19+19+14+19+19+19+19+19+19 = 265。

输入解题思路,AI测评打分。不知道怎么写?

首页