結果

問題 No.1084 積の積
ユーザー marroncastlemarroncastle
提出日時 2020-06-20 00:12:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 18,908 KB
最終ジャッジ日時 2023-09-16 16:13:53
合計ジャッジ時間 4,868 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,808 KB
testcase_01 AC 16 ms
7,812 KB
testcase_02 AC 16 ms
7,728 KB
testcase_03 AC 16 ms
7,800 KB
testcase_04 AC 220 ms
13,256 KB
testcase_05 AC 186 ms
13,200 KB
testcase_06 AC 217 ms
13,200 KB
testcase_07 AC 16 ms
7,764 KB
testcase_08 AC 15 ms
7,964 KB
testcase_09 AC 227 ms
18,072 KB
testcase_10 AC 15 ms
7,872 KB
testcase_11 AC 19 ms
8,432 KB
testcase_12 AC 60 ms
12,624 KB
testcase_13 AC 108 ms
17,472 KB
testcase_14 AC 50 ms
11,524 KB
testcase_15 AC 47 ms
11,200 KB
testcase_16 AC 122 ms
18,908 KB
testcase_17 AC 56 ms
12,064 KB
testcase_18 AC 84 ms
15,028 KB
testcase_19 AC 108 ms
17,748 KB
testcase_20 AC 37 ms
10,196 KB
testcase_21 AC 49 ms
11,680 KB
testcase_22 AC 41 ms
10,744 KB
testcase_23 AC 71 ms
14,008 KB
testcase_24 AC 66 ms
13,464 KB
testcase_25 AC 109 ms
17,612 KB
testcase_26 AC 133 ms
18,512 KB
testcase_27 AC 134 ms
18,448 KB
testcase_28 AC 134 ms
18,488 KB
testcase_29 AC 134 ms
18,556 KB
testcase_30 AC 134 ms
18,616 KB
testcase_31 AC 134 ms
18,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    ans = 1
    mod = 10**9+7
    N = int(input())
    A = list(map(int, input().split()))
    imos = [0]*(N+2)
    start = 0
    prod = 1
    for end in range(N):
        prod *= A[end]
        while prod>=10**9:
            prod //= A[start]
            start += 1
        imos[start] += 1
        imos[end+1] -= end+2-start
        imos[end+2] += end+1-start
    for i in range(1,N+1):
        imos[i] += imos[i-1]
    for i in range(1,N+1):
        imos[i] += imos[i-1]
    for i in range(N):
        ans *= pow(A[i],imos[i],mod)
        ans %= mod
    return ans
print(solve())
0