結果

問題 No.1621 Sequence Inversions
ユーザー convexineqconvexineq
提出日時 2023-07-09 17:28:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 3,000 ms
コード長 336 bytes
コンパイル時間 893 ms
コンパイル使用メモリ 87,352 KB
実行使用メモリ 76,120 KB
最終ジャッジ日時 2023-09-30 20:55:07
合計ジャッジ時間 5,498 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,240 KB
testcase_01 AC 74 ms
71,336 KB
testcase_02 AC 80 ms
75,736 KB
testcase_03 AC 80 ms
75,736 KB
testcase_04 AC 84 ms
75,864 KB
testcase_05 AC 75 ms
71,308 KB
testcase_06 AC 80 ms
75,856 KB
testcase_07 AC 81 ms
75,800 KB
testcase_08 AC 83 ms
75,724 KB
testcase_09 AC 86 ms
76,120 KB
testcase_10 AC 89 ms
76,120 KB
testcase_11 AC 86 ms
75,712 KB
testcase_12 AC 89 ms
76,000 KB
testcase_13 AC 89 ms
75,764 KB
testcase_14 AC 81 ms
75,808 KB
testcase_15 AC 81 ms
75,972 KB
testcase_16 AC 86 ms
75,656 KB
testcase_17 AC 87 ms
75,768 KB
testcase_18 AC 85 ms
75,896 KB
testcase_19 AC 79 ms
75,976 KB
testcase_20 AC 85 ms
76,052 KB
testcase_21 AC 87 ms
75,576 KB
testcase_22 AC 82 ms
75,964 KB
testcase_23 AC 88 ms
75,648 KB
testcase_24 AC 73 ms
71,176 KB
testcase_25 AC 74 ms
71,304 KB
testcase_26 AC 75 ms
71,304 KB
testcase_27 AC 74 ms
71,120 KB
testcase_28 AC 74 ms
71,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
MOD = 998244353
n,K,*a = map(int,open(0).read().split())
r = [1]+[0]*K
for c in range(1,n+1):
    for i in range(K+1-c)[::-1]:
        r[i+c] = (r[i+c]-r[i])%MOD
for k,v in itertools.groupby(sorted(a)):
    for c in range(1,len([*v])+1):
        for i in range(K+1-c):
            r[i+c] = (r[i+c]+r[i])%MOD
print(r[K])
0