結果

問題 No.2111 Sum of Diff
ユーザー ygd.ygd.
提出日時 2022-10-28 22:22:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 954 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 50,776 KB
最終ジャッジ日時 2023-09-20 05:24:49
合計ジャッジ時間 6,701 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
28,448 KB
testcase_01 AC 168 ms
28,536 KB
testcase_02 AC 289 ms
50,588 KB
testcase_03 AC 242 ms
43,900 KB
testcase_04 AC 181 ms
31,636 KB
testcase_05 AC 281 ms
50,776 KB
testcase_06 AC 279 ms
50,752 KB
testcase_07 AC 188 ms
33,956 KB
testcase_08 AC 202 ms
35,828 KB
testcase_09 AC 173 ms
29,948 KB
testcase_10 AC 171 ms
30,568 KB
testcase_11 AC 222 ms
39,104 KB
testcase_12 AC 224 ms
38,572 KB
testcase_13 AC 196 ms
35,168 KB
testcase_14 AC 267 ms
46,676 KB
testcase_15 AC 282 ms
49,868 KB
testcase_16 AC 212 ms
37,844 KB
testcase_17 AC 285 ms
50,756 KB
testcase_18 AC 201 ms
35,476 KB
testcase_19 AC 259 ms
45,420 KB
testcase_20 AC 287 ms
50,616 KB
testcase_21 AC 166 ms
28,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from re import A
import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
#import math
import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
from collections import defaultdict
#from collections import deque
#import copy #DeepCopy: hoge = [_[:] for _ in hogehoge]
#from functools import lru_cache
#@lru_cache(maxsize=None)
#MOD = pow(10,9) + 7
MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

twos = [1]
for i in range(500000):
    twos.append(twos[-1]*2%MOD)

def main():
    N = int(input())
    A = list(map(int,input().split()))

    ans = 0
    for i,a in enumerate(A):
        left = i
        right = N - (i+1)
        temp = (twos[right] - twos[left]) * a
        # print(temp)
        ans += temp%MOD
        ans %= MOD
    
    print(ans)


if __name__ == '__main__':
    main()
0