結果

問題 No.1084 積の積
ユーザー hedwig100hedwig100
提出日時 2020-06-19 22:58:41
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 753 bytes
コンパイル時間 1,081 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 93,488 KB
最終ジャッジ日時 2023-09-16 15:11:16
合計ジャッジ時間 5,264 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,424 KB
testcase_01 AC 72 ms
71,432 KB
testcase_02 AC 71 ms
71,084 KB
testcase_03 AC 72 ms
71,136 KB
testcase_04 AC 184 ms
89,668 KB
testcase_05 RE -
testcase_06 AC 180 ms
89,928 KB
testcase_07 RE -
testcase_08 AC 72 ms
71,308 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 81 ms
76,232 KB
testcase_12 AC 93 ms
81,732 KB
testcase_13 AC 107 ms
90,056 KB
testcase_14 AC 90 ms
79,508 KB
testcase_15 AC 88 ms
79,492 KB
testcase_16 AC 107 ms
91,908 KB
testcase_17 AC 91 ms
81,180 KB
testcase_18 AC 98 ms
86,604 KB
testcase_19 AC 106 ms
90,068 KB
testcase_20 AC 86 ms
77,484 KB
testcase_21 AC 90 ms
79,600 KB
testcase_22 AC 88 ms
78,288 KB
testcase_23 AC 97 ms
83,904 KB
testcase_24 AC 93 ms
82,980 KB
testcase_25 AC 104 ms
90,148 KB
testcase_26 AC 113 ms
90,224 KB
testcase_27 AC 114 ms
90,180 KB
testcase_28 AC 114 ms
90,408 KB
testcase_29 AC 114 ms
90,556 KB
testcase_30 AC 116 ms
90,584 KB
testcase_31 AC 112 ms
90,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 9

def main():
    N = int(input())
    A = list(map(int,input().split()))

    r = 0
    now = 1
    cnt = [0] * (N + 1)
    for l in range(N):
        while r < N and now * A[r] < INF:
            now *= A[r]
            r += 1
        if l > 0:
            cnt[l - 1] -= r - l + 1
        if r > 0:
            cnt[r - 1] += 1
        if l > 1:
            cnt[l - 2] += r - l
        now //= A[l]

    for i in range(N - 1,-1,-1):
        cnt[i] += cnt[i + 1]
    for i in range(N - 1,-1,-1):
        cnt[i] += cnt[i + 1]
        
    ans = 1
    for i in range(N):
        ans *= pow(A[i],cnt[i],MOD)
        ans %= MOD
    print(ans)
  
if __name__ == '__main__':
    main()
0