AT_awtf2026algo_c.Count by Descents

入门

通过率:0%

时间限制:10.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

Define the score of a sequence of length NN, x=(x1,x2,…,xN)x=(x_1,x_2,\ldots,x_N), as ∏1≤i≤N(i+xi)\prod_{1 \leq i \leq N} (i+x_i).

You are given a strictly increasing sequence of non-negative integers of length NN, A=(A1,A2,…,AN)A=(A_1,A_2,\ldots,A_N).

Solve the following problem for each d=0,1,…,N−1d=0,1,\ldots,N-1.

  • Consider the sequences xx obtained by rearranging the elements of AA such that there are exactly dd indices ii with xi>xi+1x_i>x_{i+1}. Find, modulo 998244353998244353, the sum of the scores over all such sequences.

定义长度为 NN 的序列 x=(x1,x2,…,xN)x=(x_1,x_2,\ldots,x_N) 的得分为 ∏1≤i≤N(i+xi)\prod_{1 \leq i \leq N} (i+x_i)。

给定一个长度为 NN 的严格递增的非负整数序列 A=(A1,A2,…,AN)A=(A_1,A_2,\ldots,A_N)。

对每个 d=0,1,…,N−1d=0,1,\ldots,N-1,求解以下问题:

  • 考虑所有由 AA 的元素重排得到的序列 xx,其中恰好有 dd 个下标 ii 满足 xi>xi+1x_i>x_{i+1}。求所有此类序列的得分之和,并对 998244353998244353 取模。

输入格式

The input is given from Standard Input in the following format:

NN
A1A_1 A2A_2 …\ldots ANA_N

输入从标准输入中按以下格式给出:

NN
A1A_1 A2A_2 …\ldots ANA_N

输出格式

For each d=0,1,…,N−1d=0,1,\ldots,N-1 in this order, output the answer.

按 d=0,1,…,N−1d=0,1,\ldots,N-1 的顺序,对每个 dd 输出答案。

输入输出样例

  • 输入#1

    2
    0 1

    输出#1

    3 4
  • 输入#2

    3
    0 1 2

    输出#2

    15 84 27
  • 输入#3

    4
    1 2 4 8

    输出#3

    672 9766 11824 1350
  • 输入#4

    10
    19237225 22672563 250040585 250876592 344065186 404191279 519729086 709423541 785439575 945005786

    输出#4

    950922061 100128042 407190855 824408778 310751908 135850478 488617013 247896647 212541677 410171196
  • 输入#5

    80
    22039836 28981946 30860430 45459908 69714419 80565655 86264514 88704853 91058795 111982636 139793596 151769562 164543594 197971506 210619166 221745114 225051881 238856535 245101681 248730678 255908811 256810168 272481811 273714212 283615535 284686636 297323928 298241991 319502970 321722967 360690308 361481447 366075547 418633758 422209788 423073188 433378197 437330820 459117401 480124392 485979799 486475154 490049033 498896932 504089816 518458804 520999410 531470304 542901248 560047125 582857561 595934547 619322493 622712481 627798362 686621115 695016247 712639027 714635866 721488863 735151983 742973826 753705854 758288417 768080799 775681305 834897126 851716760 855572558 858395194 905527130 907645400 908902333 922571073 933505674 948631706 966125570 978445563 979797105 985573661

    输出#5

    298255098 551019397 284987769 99242062 369815630 718585554 688109983 392309922 737456536 523073775 694983953 356882261 567442787 317777842 776589570 791050897 233517530 674210008 665902332 505999118 194082824 507392235 703668642 165275650 789544696 135388036 169254144 708650783 647965741 603841383 863435804 818717034 510094830 247810285 479685478 505643001 637957324 951738617 677727811 891846762 611641571 564907071 866950984 142999964 318492053 834273618 862706905 372559206 72047272 966554479 825019950 285454795 341834405 779072147 246845153 958325353 790516997 805752624 345221877 580204783 779467953 925770800 711605667 652190020 304063629 645132429 538451131 174490604 596444184 12799293 750957647 585286962 463254142 857306647 282172657 929005032 870614339 445303380 729482922 179226742

说明/提示

Sample 1 Explanation:
The permutations and scores corresponding to each dd are as follows.

  • d=0d=0:
    • x=(0,1)x=(0,1): the score is (1+0)×(2+1)=3(1+0) \times (2+1)=3
  • d=1d=1:
    • x=(1,0)x=(1,0): the score is (1+1)×(2+0)=4(1+1) \times (2+0)=4

Sample 2 Explanation:
The permutations and scores corresponding to each dd are as follows.

  • d=0d=0:
    • x=(0,1,2)x=(0,1,2): the score is (1+0)×(2+1)×(3+2)=15(1+0) \times (2+1) \times (3+2)=15
  • d=1d=1:
    • x=(0,2,1)x=(0,2,1): the score is (1+0)×(2+2)×(3+1)=16(1+0) \times (2+2) \times (3+1)=16
    • x=(1,0,2)x=(1,0,2): the score is (1+1)×(2+0)×(3+2)=20(1+1) \times (2+0) \times (3+2)=20
    • x=(1,2,0)x=(1,2,0): the score is (1+1)×(2+2)×(3+0)=24(1+1) \times (2+2) \times (3+0)=24
    • x=(2,0,1)x=(2,0,1): the score is (1+2)×(2+0)×(3+1)=24(1+2) \times (2+0) \times (3+1)=24
  • d=2d=2:
    • x=(2,1,0)x=(2,1,0): the score is (1+2)×(2+1)×(3+0)=27(1+2) \times (2+1) \times (3+0)=27

Constraints

  • 2≤N≤802 \leq N \leq 80
  • 0≤A1<A2<⋯<AN<9982443530 \leq A_1 < A_2 < \cdots < A_N < 998244353
  • All input values are integers.

样例 1 解释:
对应每个 dd 的排列及其得分如下。

  • d=0d=0:
    • x=(0,1)x=(0,1):得分为 (1+0)×(2+1)=3(1+0) \times (2+1)=3
  • d=1d=1:
    • x=(1,0)x=(1,0):得分为 (1+1)×(2+0)=4(1+1) \times (2+0)=4

样例 2 解释:
对应每个 dd 的排列及其得分如下。

  • d=0d=0:
    • x=(0,1,2)x=(0,1,2):得分为 (1+0)×(2+1)×(3+2)=15(1+0) \times (2+1) \times (3+2)=15
  • d=1d=1:
    • x=(0,2,1)x=(0,2,1):得分为 (1+0)×(2+2)×(3+1)=16(1+0) \times (2+2) \times (3+1)=16
    • x=(1,0,2)x=(1,0,2):得分为 (1+1)×(2+0)×(3+2)=20(1+1) \times (2+0) \times (3+2)=20
    • x=(1,2,0)x=(1,2,0):得分为 (1+1)×(2+2)×(3+0)=24(1+1) \times (2+2) \times (3+0)=24
    • x=(2,0,1)x=(2,0,1):得分为 (1+2)×(2+0)×(3+1)=24(1+2) \times (2+0) \times (3+1)=24
  • d=2d=2:
    • x=(2,1,0)x=(2,1,0):得分为 (1+2)×(2+1)×(3+0)=27(1+2) \times (2+1) \times (3+0)=27

约束条件

  • 2≤N≤802 \leq N \leq 80
  • 0≤A1<A2<⋯<AN<9982443530 \leq A_1 < A_2 < \cdots < A_N < 998244353
  • 所有输入值均为整数。

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

首页