結果

問題 No.2111 Sum of Diff
ユーザー shotoyooshotoyoo
提出日時 2022-10-28 21:40:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 232 ms / 2,000 ms
コード長 914 bytes
コンパイル時間 836 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 112,444 KB
最終ジャッジ日時 2023-09-20 04:30:32
合計ジャッジ時間 5,526 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
72,152 KB
testcase_01 AC 94 ms
71,900 KB
testcase_02 AC 232 ms
111,944 KB
testcase_03 AC 187 ms
101,164 KB
testcase_04 AC 114 ms
80,520 KB
testcase_05 AC 229 ms
112,176 KB
testcase_06 AC 231 ms
112,108 KB
testcase_07 AC 130 ms
84,036 KB
testcase_08 AC 146 ms
87,580 KB
testcase_09 AC 110 ms
78,624 KB
testcase_10 AC 115 ms
78,848 KB
testcase_11 AC 161 ms
91,636 KB
testcase_12 AC 159 ms
91,728 KB
testcase_13 AC 134 ms
86,220 KB
testcase_14 AC 208 ms
104,824 KB
testcase_15 AC 227 ms
112,080 KB
testcase_16 AC 152 ms
90,192 KB
testcase_17 AC 229 ms
112,444 KB
testcase_18 AC 138 ms
86,140 KB
testcase_19 AC 198 ms
104,272 KB
testcase_20 AC 230 ms
112,176 KB
testcase_21 AC 106 ms
77,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, random
input = lambda : sys.stdin.readline().rstrip()


write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input()); SI=lambda : [ord(c)-ord("a") for c in input()]
def debug(_l_):
    for s in _l_.split():
        print(f"{s}={eval(s)}", end=" ")
    print()
def dlist(*l, fill=0):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]

n = int(input())
a = list(map(int, input().split()))
M = 998244353
ans = 0
vals = [0]*(n+1)
for i in range(1,n+1):
    val = pow(2, i, M) - 1
    vals[i] = val
for i in range(n):
    val = -vals[i] + vals[n-1-i]
    ans += a[i] * (val) % M
    ans %= M
#     print(i, val)
print(ans%M)
0