結果

問題 No.1299 Random Array Score
ユーザー roarisroaris
提出日時 2020-11-27 22:46:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 732 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 105,188 KB
最終ジャッジ日時 2023-10-09 20:48:54
合計ジャッジ時間 15,859 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,332 KB
testcase_01 AC 70 ms
71,208 KB
testcase_02 AC 70 ms
71,576 KB
testcase_03 AC 689 ms
100,528 KB
testcase_04 AC 719 ms
100,336 KB
testcase_05 AC 561 ms
100,104 KB
testcase_06 AC 503 ms
97,704 KB
testcase_07 AC 516 ms
97,920 KB
testcase_08 AC 676 ms
100,272 KB
testcase_09 AC 98 ms
76,492 KB
testcase_10 AC 314 ms
87,568 KB
testcase_11 AC 148 ms
78,028 KB
testcase_12 AC 523 ms
95,276 KB
testcase_13 AC 656 ms
99,992 KB
testcase_14 AC 487 ms
95,452 KB
testcase_15 AC 522 ms
97,580 KB
testcase_16 AC 533 ms
97,736 KB
testcase_17 AC 165 ms
79,388 KB
testcase_18 AC 323 ms
88,844 KB
testcase_19 AC 400 ms
91,616 KB
testcase_20 AC 252 ms
83,588 KB
testcase_21 AC 96 ms
76,652 KB
testcase_22 AC 183 ms
79,772 KB
testcase_23 AC 483 ms
97,668 KB
testcase_24 AC 553 ms
100,220 KB
testcase_25 AC 470 ms
95,472 KB
testcase_26 AC 93 ms
76,604 KB
testcase_27 AC 187 ms
80,472 KB
testcase_28 AC 162 ms
78,912 KB
testcase_29 AC 214 ms
81,968 KB
testcase_30 AC 451 ms
95,188 KB
testcase_31 AC 222 ms
81,724 KB
testcase_32 AC 646 ms
100,132 KB
testcase_33 AC 732 ms
100,484 KB
testcase_34 AC 684 ms
105,188 KB
testcase_35 AC 122 ms
99,408 KB
testcase_36 AC 104 ms
103,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 998244353

if K==0:
    print(sum(A)%MOD)
    exit()

S = sum(A)*pow(N, K, MOD)

for Ai in A:
    S = (S+N*(pow(2, K, MOD)-1)*Ai*pow(N, K-1, MOD))%MOD

S = (S*pow(pow(N, K, MOD), MOD-2, MOD))%MOD
print(S)
0