結果

問題 No.2111 Sum of Diff
ユーザー terasaterasa
提出日時 2022-10-28 21:46:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 418 ms / 2,000 ms
コード長 676 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 115,304 KB
最終ジャッジ日時 2023-09-20 04:39:12
合計ジャッジ時間 8,370 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 171 ms
80,000 KB
testcase_01 AC 173 ms
79,868 KB
testcase_02 AC 418 ms
115,264 KB
testcase_03 AC 337 ms
105,400 KB
testcase_04 AC 208 ms
85,920 KB
testcase_05 AC 413 ms
115,180 KB
testcase_06 AC 411 ms
115,168 KB
testcase_07 AC 230 ms
89,424 KB
testcase_08 AC 251 ms
92,476 KB
testcase_09 AC 193 ms
83,984 KB
testcase_10 AC 199 ms
84,588 KB
testcase_11 AC 283 ms
98,304 KB
testcase_12 AC 280 ms
100,660 KB
testcase_13 AC 243 ms
91,464 KB
testcase_14 AC 360 ms
108,196 KB
testcase_15 AC 395 ms
114,860 KB
testcase_16 AC 265 ms
95,284 KB
testcase_17 AC 403 ms
115,080 KB
testcase_18 AC 247 ms
91,588 KB
testcase_19 AC 350 ms
107,404 KB
testcase_20 AC 404 ms
115,304 KB
testcase_21 AC 186 ms
83,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from typing import List, Tuple, Callable, TypeVar
import sys
import itertools
import heapq
import math
import bisect
from collections import deque, defaultdict
from functools import lru_cache, cmp_to_key

input = sys.stdin.readline

# for AtCoder Easy test
if __file__ != 'prog.py':
    sys.setrecursionlimit(10 ** 6)


def readints(): return map(int, input().split())
def readlist(): return list(readints())
def readstr(): return input()[:-1]


N = int(input())
A = readlist()
mod = 998244353

D = [A[i] - A[i + 1] for i in range(N - 1)]
ans = 0
for i in range(N - 1):
    ans += D[i] * (pow(2, i + 1, mod) - 1) * (pow(2, N - 1 - i, mod) - 1) % mod
    ans %= mod
print(ans)
0