結果
| 問題 |
No.2111 Sum of Diff
|
| コンテスト | |
| ユーザー |
terasa
|
| 提出日時 | 2022-10-28 21:46:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 303 ms / 2,000 ms |
| コード長 | 676 bytes |
| コンパイル時間 | 169 ms |
| コンパイル使用メモリ | 82,424 KB |
| 実行使用メモリ | 116,928 KB |
| 最終ジャッジ日時 | 2024-07-06 00:52:12 |
| 合計ジャッジ時間 | 5,314 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
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)
terasa