結果

問題 No.1681 +-*
ユーザー asumo0729
提出日時 2021-09-17 21:56:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 663 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,668 KB
実行使用メモリ 107,940 KB
最終ジャッジ日時 2024-06-29 20:22:48
合計ジャッジ時間 4,777 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
from collections import defaultdict, deque
import heapq
import bisect

stdin=sys.stdin
sys.setrecursionlimit(10 ** 8)

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')
inf = 1 << 60
eps = 1e-9
sortkey = itemgetter(0)
mod = 10 ** 9+ 7

###############################################################
N = ip()
A = lp()
ans = 0
## a1 +- a2...

now = 1

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