結果

問題 No.1084 積の積
ユーザー neterukunneterukun
提出日時 2020-06-20 12:42:45
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 516 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 91,996 KB
最終ジャッジ日時 2023-09-16 17:11:04
合計ジャッジ時間 6,168 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,316 KB
testcase_01 AC 71 ms
71,376 KB
testcase_02 AC 74 ms
71,324 KB
testcase_03 AC 72 ms
70,936 KB
testcase_04 AC 205 ms
89,364 KB
testcase_05 RE -
testcase_06 AC 204 ms
89,132 KB
testcase_07 AC 71 ms
70,920 KB
testcase_08 AC 70 ms
71,368 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 87 ms
76,588 KB
testcase_12 AC 119 ms
81,648 KB
testcase_13 AC 165 ms
89,560 KB
testcase_14 AC 112 ms
79,412 KB
testcase_15 AC 108 ms
79,524 KB
testcase_16 AC 176 ms
91,700 KB
testcase_17 AC 118 ms
80,904 KB
testcase_18 AC 143 ms
86,260 KB
testcase_19 AC 164 ms
89,552 KB
testcase_20 AC 99 ms
77,540 KB
testcase_21 AC 111 ms
79,312 KB
testcase_22 AC 106 ms
78,308 KB
testcase_23 AC 131 ms
83,616 KB
testcase_24 AC 126 ms
82,436 KB
testcase_25 AC 163 ms
89,432 KB
testcase_26 AC 183 ms
89,884 KB
testcase_27 AC 187 ms
89,912 KB
testcase_28 AC 187 ms
89,680 KB
testcase_29 AC 184 ms
89,888 KB
testcase_30 AC 182 ms
89,680 KB
testcase_31 AC 184 ms
90,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
LIMIT = 10 ** 9
MOD = 10 ** 9 + 7


# 区間[l, r)を考えつつつ、lとrを尺取りする
r = 0
ru_val = 1
ptn_val = 1
ans = 1
for l in range(n):
    if l > 0:
        ru_val //= a[l - 1]
        ptn_val *= pow(pow(a[l - 1], (r - (l - 1)), MOD), MOD - 2, MOD)
        ptn_val %= MOD
    while r < n and  ru_val * a[r] < LIMIT:
        ru_val *= a[r]
        ptn_val *= ru_val
        ptn_val %= MOD
        r += 1
    ans *= ptn_val
    ans %= MOD
print(ans)
0