結果

問題 No.1681 +-*
ユーザー asumo0729asumo0729
提出日時 2021-09-17 21:57:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 695 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 265,668 KB
最終ジャッジ日時 2023-09-12 07:25:35
合計ジャッジ時間 4,775 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
75,612 KB
testcase_01 AC 92 ms
71,672 KB
testcase_02 AC 98 ms
72,080 KB
testcase_03 AC 98 ms
72,060 KB
testcase_04 AC 121 ms
72,208 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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
p = pow(3, N - 1, mod)
q = pow(3, mod - 2, mod)

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