QOJ.ac

QOJ

Time Limit: 2.5 s Memory Limit: 1024 MB Total points: 100

#9651. 又一个欧拉数问题

Statistics

题目描述

给定 $k$ 以及系数序列 $w_0 \sim w_{2^{k-1}-1}$。定义一个 $n \ge k$ 阶排列 $p$ 的权值 $$ \text{val}(p) = \prod_{i=1}^{n-k+1} w_{f(p_i, p_{i+1}, \dots, p_{i+k-1})} $$ 其中 $$ f(a_1, a_2, \dots, a_k) = \sum_{i=1}^{k-1} 2^{i-1} [a_i < a_{i+1}] $$ 给定 $n$,计算所有 $n$ 阶排列的权值和 $\bmod \, 998244353$。

输入格式

第一行两个整数 $n, k$。

第二行 $2^{k - 1}$ 个整数,第 $i$ 个整数表示 $w_{i-1}$。

输出格式

一行一个整数,表示答案 $\bmod , 998244353$。

样例

样例 #1

样例输入 #1
3 2
1 2
样例输出 #1
13

样例 #2

样例输入 #2
5 3
1 2 3 4
样例输出 #2
1875

样例 #3

样例输入 #3
6 4
1 2 3 4 5 6 7 8
样例输出 #3
68850

数据范围

本题使用捆绑测试,你只有通过一个子任务的所有测试点,才能获得这个子任务的分数。

子任务编号 $n \le$ $k =$ 分值
$1$ $10$ $4$ $5$
$2$ $20$ $4$ $10$
$3$ $10^5$ $2$ $5$
$4$ $100$ $3$ $10$
$5$ $4000$ $3$ $10$
$6$ $4 \times 10^4$ $3$ $15$
$7$ $10^5$ $3$ $5$
$8$ $2000$ $4$ $10$
$9$ $4 \times 10^4$ $4$ $10$
$10$ $10^5$ $4$ $20$

对于所有数据:$2 \le k \le 4$,$k \le n \le 10^5$,$0 \le w_i < 998244353$。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.