結果

問題 No.1681 +-*
ユーザー 👑 hitonanodehitonanode
提出日時 2021-08-08 16:56:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 315 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 30,076 KB
最終ジャッジ日時 2023-09-12 06:20:11
合計ジャッジ時間 27,422 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,808 KB
testcase_01 AC 16 ms
7,960 KB
testcase_02 AC 17 ms
7,784 KB
testcase_03 AC 17 ms
7,968 KB
testcase_04 AC 16 ms
7,836 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 94 ms
18,896 KB
testcase_14 AC 171 ms
29,812 KB
testcase_15 AC 15 ms
7,832 KB
testcase_16 AC 15 ms
7,820 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# TLE Python3 で 2.4 秒くらい?
N = int(input())
A = list(map(int, input().split()))

md = 1000000007

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

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

print(ret % md)
0