結果

問題 No.1084 積の積
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-06-19 22:53:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 1,246 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 110,092 KB
最終ジャッジ日時 2023-09-16 15:06:43
合計ジャッジ時間 7,226 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,532 KB
testcase_01 AC 69 ms
71,348 KB
testcase_02 AC 70 ms
71,332 KB
testcase_03 AC 68 ms
71,236 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 AC 330 ms
110,092 KB
testcase_07 RE -
testcase_08 AC 68 ms
71,404 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 82 ms
76,668 KB
testcase_12 AC 135 ms
90,252 KB
testcase_13 AC 200 ms
100,060 KB
testcase_14 AC 123 ms
85,256 KB
testcase_15 AC 121 ms
85,152 KB
testcase_16 AC 222 ms
98,336 KB
testcase_17 AC 130 ms
88,616 KB
testcase_18 AC 180 ms
98,916 KB
testcase_19 AC 205 ms
100,204 KB
testcase_20 AC 110 ms
81,188 KB
testcase_21 AC 124 ms
85,256 KB
testcase_22 AC 112 ms
83,056 KB
testcase_23 AC 151 ms
94,712 KB
testcase_24 AC 148 ms
92,308 KB
testcase_25 AC 200 ms
100,200 KB
testcase_26 AC 233 ms
99,112 KB
testcase_27 AC 238 ms
99,352 KB
testcase_28 AC 235 ms
99,344 KB
testcase_29 AC 234 ms
99,224 KB
testcase_30 AC 233 ms
99,272 KB
testcase_31 AC 237 ms
99,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, = map(int, input().split())
mod = 10**9+7
X = list(map(int, input().split()))
X.append(10**9+7)
j = 0
sm = 1
Cs = [0]*N
for i in range(N):
    while sm*X[j]<=10**9:
        sm *= X[j]
#        print(j, X[j], sm, j-i)
#        Cs[j] += j-i
        j += 1
    Cs[i] += j-i
    sm//=X[i]
#print(Cs)
D = []
for i in range(N):
    D.append((i*2, Cs[i]))
    D.append(((i+Cs[i])*2+1, Cs[i]))
#print(sorted(D))

D = sorted(D)
R = 1
cnt = 0
xm = 0
for idx, c in D:
    if idx%2:
        cnt -= 1
    else:
        idx //= 2
        xm -= cnt
#        print(xm, cnt, c+xm)
        R = R * pow(X[idx], c+xm, mod) % mod
        cnt += 1
        xm += c
print(R)

0