結果

問題 No.1084 積の積
ユーザー ttrttr
提出日時 2020-06-19 23:31:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 18,804 KB
最終ジャッジ日時 2023-09-16 15:46:53
合計ジャッジ時間 6,863 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,968 KB
testcase_01 AC 15 ms
7,884 KB
testcase_02 AC 15 ms
7,972 KB
testcase_03 AC 15 ms
7,848 KB
testcase_04 WA -
testcase_05 AC 271 ms
12,848 KB
testcase_06 AC 314 ms
12,764 KB
testcase_07 AC 15 ms
7,796 KB
testcase_08 AC 16 ms
7,820 KB
testcase_09 AC 308 ms
18,236 KB
testcase_10 AC 16 ms
7,884 KB
testcase_11 AC 22 ms
8,688 KB
testcase_12 AC 100 ms
12,704 KB
testcase_13 AC 190 ms
17,492 KB
testcase_14 AC 80 ms
11,400 KB
testcase_15 AC 73 ms
11,352 KB
testcase_16 AC 219 ms
18,804 KB
testcase_17 AC 88 ms
12,220 KB
testcase_18 AC 150 ms
15,228 KB
testcase_19 AC 198 ms
17,760 KB
testcase_20 AC 55 ms
10,056 KB
testcase_21 AC 79 ms
11,516 KB
testcase_22 AC 63 ms
10,572 KB
testcase_23 AC 117 ms
13,912 KB
testcase_24 AC 113 ms
13,036 KB
testcase_25 AC 192 ms
17,440 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
r = 0
num = 1
for i in range(N):
    while r < N and num*A[r] < 10**9:
        num *= A[r]
        if r > i:
            L[r] -= 1
        r += 1
    if r < N:
        L[r] -= 1
        L[i] += r-i
        num //= A[i]
    else:
        l = i
        break

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

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

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

print(ans)
0