結果

問題 No.1084 積の積
ユーザー tanon710tanon710
提出日時 2020-06-19 22:31:07
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 674 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 94,116 KB
最終ジャッジ日時 2023-09-16 14:46:56
合計ジャッジ時間 5,435 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,360 KB
testcase_01 AC 73 ms
71,596 KB
testcase_02 AC 76 ms
71,304 KB
testcase_03 AC 73 ms
71,360 KB
testcase_04 AC 185 ms
91,904 KB
testcase_05 RE -
testcase_06 AC 186 ms
91,788 KB
testcase_07 RE -
testcase_08 AC 72 ms
71,592 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 90 ms
76,916 KB
testcase_12 AC 99 ms
82,944 KB
testcase_13 AC 113 ms
91,968 KB
testcase_14 AC 95 ms
80,320 KB
testcase_15 AC 95 ms
80,404 KB
testcase_16 AC 120 ms
94,116 KB
testcase_17 AC 98 ms
82,000 KB
testcase_18 AC 106 ms
87,708 KB
testcase_19 AC 114 ms
92,024 KB
testcase_20 AC 92 ms
78,224 KB
testcase_21 AC 96 ms
80,368 KB
testcase_22 AC 93 ms
78,996 KB
testcase_23 AC 102 ms
85,132 KB
testcase_24 AC 100 ms
84,000 KB
testcase_25 AC 113 ms
92,004 KB
testcase_26 AC 126 ms
92,948 KB
testcase_27 AC 127 ms
92,828 KB
testcase_28 AC 127 ms
92,908 KB
testcase_29 AC 127 ms
92,896 KB
testcase_30 AC 122 ms
92,816 KB
testcase_31 AC 123 ms
92,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
n=int(input())
arr=list(map(int,input().split()))
rs=[-1]*n
tmp=1
pos=0
for i in range(n):
    for j in range(max(i,pos),n):
        tmp*=arr[j]
        if tmp>=10**9:
            rs[i]=j
            pos=j
            tmp//=arr[j]
            break
    else:
        rs[i]=n
        pos=n
    tmp//=arr[i]
imos1=[0]*(n+1)
imos2=[0]*(n+1)
for i in range(n):
    imos1[i]=rs[i]-i
    imos2[i+1]+=-1
    if rs[i]+1<=n:
        imos2[rs[i]+1]+=1
for i in range(1,n+1):
    imos2[i]+=imos2[i-1]
for i in range(n):
    imos1[i]+=imos2[i]
for i in range(1,n+1):
    imos1[i]+=imos1[i-1]
ans=1
for i in range(n):
    ans*=pow(arr[i],imos1[i],mod)
    ans%=mod
print(ans)
0