結果

問題 No.1681 +-*
ユーザー terasaterasa
提出日時 2022-06-07 12:41:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,006 bytes
コンパイル時間 1,464 ms
コンパイル使用メモリ 81,504 KB
実行使用メモリ 105,280 KB
最終ジャッジ日時 2023-10-21 03:49:20
合計ジャッジ時間 6,897 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
55,780 KB
testcase_01 AC 47 ms
55,624 KB
testcase_02 AC 48 ms
55,624 KB
testcase_03 AC 46 ms
55,624 KB
testcase_04 AC 49 ms
57,672 KB
testcase_05 AC 191 ms
103,760 KB
testcase_06 AC 185 ms
103,776 KB
testcase_07 AC 192 ms
103,984 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 #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

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