結果

問題 No.1084 積の積
ユーザー ttrttr
提出日時 2020-06-19 22:39:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 451 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 18,836 KB
最終ジャッジ日時 2023-09-16 14:54:21
合計ジャッジ時間 5,914 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,768 KB
testcase_01 AC 16 ms
7,828 KB
testcase_02 AC 16 ms
7,824 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 248 ms
13,840 KB
testcase_06 AC 287 ms
13,896 KB
testcase_07 AC 16 ms
7,828 KB
testcase_08 AC 16 ms
7,736 KB
testcase_09 AC 294 ms
18,048 KB
testcase_10 AC 16 ms
7,876 KB
testcase_11 AC 22 ms
8,560 KB
testcase_12 AC 92 ms
12,836 KB
testcase_13 AC 180 ms
17,684 KB
testcase_14 AC 74 ms
11,404 KB
testcase_15 AC 70 ms
11,272 KB
testcase_16 AC 200 ms
18,836 KB
testcase_17 AC 86 ms
12,088 KB
testcase_18 AC 137 ms
15,188 KB
testcase_19 AC 175 ms
18,000 KB
testcase_20 AC 53 ms
10,084 KB
testcase_21 AC 75 ms
11,584 KB
testcase_22 AC 61 ms
10,652 KB
testcase_23 AC 112 ms
13,752 KB
testcase_24 AC 105 ms
13,492 KB
testcase_25 AC 174 ms
17,576 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [int(a) for a in input().split()]
mod = 10**9+7

L = [0]*N
l = 0
num = 1
for r in range(N):
    num *= A[r]
    if num < 10**9:
        L[l] += 1
        if r < N-1:
            L[r+1] -= 1
        continue
    while num >= 10**9 and l < r:
        num //= A[l]
        l += 1
    L[l] += 1
    if r < N-1:
        L[r+1] -= 1

for i in range(N-1):
    L[i+1] += L[i]

if l > 0:
    L[l] += N-l-1
for i in range(l+1, N):
    L[i] += (i-l)*(N-i)

ans = 1
for i in range(N):
    ans *= pow(A[i], L[i], mod)
    ans %= mod

print(ans)
0