結果

問題 No.1084 積の積
ユーザー mkawa2mkawa2
提出日時 2021-05-28 11:17:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,006 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 13,056 KB
実行使用メモリ 20,152 KB
最終ジャッジ日時 2024-04-24 17:06:01
合計ジャッジ時間 11,884 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,624 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 31 ms
10,624 KB
testcase_04 AC 400 ms
12,544 KB
testcase_05 RE -
testcase_06 AC 351 ms
12,672 KB
testcase_07 RE -
testcase_08 AC 30 ms
10,624 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 51 ms
11,264 KB
testcase_12 AC 280 ms
14,652 KB
testcase_13 AC 544 ms
18,940 KB
testcase_14 AC 214 ms
13,592 KB
testcase_15 AC 202 ms
13,580 KB
testcase_16 AC 632 ms
20,152 KB
testcase_17 AC 257 ms
14,332 KB
testcase_18 AC 413 ms
16,824 KB
testcase_19 AC 552 ms
18,992 KB
testcase_20 AC 147 ms
12,672 KB
testcase_21 AC 217 ms
13,736 KB
testcase_22 AC 174 ms
12,928 KB
testcase_23 AC 343 ms
15,636 KB
testcase_24 AC 313 ms
15,224 KB
testcase_25 AC 549 ms
18,988 KB
testcase_26 AC 640 ms
19,756 KB
testcase_27 AC 633 ms
19,632 KB
testcase_28 AC 632 ms
19,500 KB
testcase_29 AC 641 ms
19,632 KB
testcase_30 AC 638 ms
19,888 KB
testcase_31 AC 645 ms
19,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# 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)]
dij = [(0, 1), (1, 0), (1, 1), (1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7

lim = 10**9
n = II()
aa = LI()

ans = p = cp = 1
r = 0
for l, a in enumerate(aa):
    while r < n and p*aa[r] < lim:
        p *= aa[r]
        cp = cp*p%md
        r += 1
    ans = ans*cp%md
    p //= a
    cp = cp*pow(pow(a, md-2, md), r-l, md)

print(ans)
0