結果

問題 No.1681 +-*
ユーザー mkawa2mkawa2
提出日時 2023-01-12 22:48:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 889 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 104,952 KB
最終ジャッジ日時 2023-08-25 03:13:24
合計ジャッジ時間 6,124 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,484 KB
testcase_01 AC 69 ms
71,096 KB
testcase_02 AC 70 ms
71,216 KB
testcase_03 AC 70 ms
71,364 KB
testcase_04 AC 69 ms
71,392 KB
testcase_05 AC 190 ms
104,796 KB
testcase_06 AC 188 ms
104,860 KB
testcase_07 AC 187 ms
104,952 KB
testcase_08 AC 202 ms
100,096 KB
testcase_09 AC 204 ms
99,976 KB
testcase_10 AC 202 ms
100,016 KB
testcase_11 AC 205 ms
100,224 KB
testcase_12 AC 202 ms
100,148 KB
testcase_13 AC 132 ms
90,680 KB
testcase_14 AC 202 ms
99,972 KB
testcase_15 AC 69 ms
71,504 KB
testcase_16 AC 71 ms
71,200 KB
testcase_17 AC 203 ms
99,892 KB
testcase_18 AC 204 ms
100,144 KB
testcase_19 AC 204 ms
100,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

n = II()
aa = LI()

m=1
ans=0
for i,a in enumerate(aa):
    m*=a
    m%=md
    if i==n-1:break
    ans+=m*pow(3,n-i-2,md)*2%md
    ans%=md
ans+=m

print(ans%md)
0