結果

問題 No.1681 +-*
ユーザー 👑 hitonanodehitonanode
提出日時 2021-08-08 16:47:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 308 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 106,100 KB
最終ジャッジ日時 2023-09-12 06:18:40
合計ジャッジ時間 6,099 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,412 KB
testcase_01 AC 74 ms
71,396 KB
testcase_02 AC 74 ms
71,128 KB
testcase_03 AC 74 ms
71,292 KB
testcase_04 AC 76 ms
71,160 KB
testcase_05 AC 112 ms
105,708 KB
testcase_06 AC 112 ms
105,672 KB
testcase_07 AC 125 ms
106,100 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# TLE
N = int(input())
A = list(map(int, input().split()))

md = 1000000007

ret, prod = 0, 1
d23 = 2 * pow(3, md - 2, md) % md

for i, a in enumerate(A):
    ret = ret * 3 % md
    if prod:
        prod *= a  # mod をとっていない
        ret += prod * (d23 if i < N - 1 else 1) % md

print(ret % md)
0