結果

問題 No.2111 Sum of Diff
ユーザー syunsukesyunsuke
提出日時 2022-11-27 00:18:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 108,872 KB
最終ジャッジ日時 2024-04-14 09:50:08
合計ジャッジ時間 3,011 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,360 KB
testcase_01 AC 37 ms
51,996 KB
testcase_02 AC 105 ms
102,048 KB
testcase_03 AC 86 ms
99,020 KB
testcase_04 AC 50 ms
68,172 KB
testcase_05 AC 108 ms
102,076 KB
testcase_06 AC 105 ms
102,280 KB
testcase_07 AC 55 ms
76,124 KB
testcase_08 AC 62 ms
83,084 KB
testcase_09 AC 46 ms
63,768 KB
testcase_10 AC 47 ms
65,924 KB
testcase_11 AC 72 ms
91,224 KB
testcase_12 AC 71 ms
91,008 KB
testcase_13 AC 59 ms
79,680 KB
testcase_14 AC 90 ms
102,488 KB
testcase_15 AC 97 ms
108,872 KB
testcase_16 AC 65 ms
87,824 KB
testcase_17 AC 103 ms
102,056 KB
testcase_18 AC 59 ms
79,968 KB
testcase_19 AC 86 ms
102,020 KB
testcase_20 AC 102 ms
102,120 KB
testcase_21 AC 44 ms
60,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
L = list(map(int,input().split()))
L = L[::-1]
S = 0
mod = 998244353
S = 1
SUM = L[0]
ans = 0
for i in range(1,len(L)):
    ans += L[i]*S - SUM
    SUM += (SUM + L[i])
    SUM %= mod
    S += (S+1)
    S %= mod
print(ans%mod)
0