結果

問題 No.1084 積の積
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-06-19 22:58:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 681 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 110,144 KB
最終ジャッジ日時 2023-09-16 15:11:04
合計ジャッジ時間 7,500 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,508 KB
testcase_01 AC 75 ms
71,084 KB
testcase_02 AC 72 ms
71,028 KB
testcase_03 AC 71 ms
71,384 KB
testcase_04 WA -
testcase_05 AC 340 ms
110,144 KB
testcase_06 AC 340 ms
108,492 KB
testcase_07 AC 71 ms
71,368 KB
testcase_08 AC 72 ms
71,272 KB
testcase_09 AC 274 ms
96,328 KB
testcase_10 AC 72 ms
71,260 KB
testcase_11 AC 90 ms
76,816 KB
testcase_12 AC 145 ms
90,088 KB
testcase_13 AC 208 ms
99,700 KB
testcase_14 AC 131 ms
85,160 KB
testcase_15 AC 131 ms
84,744 KB
testcase_16 AC 226 ms
98,144 KB
testcase_17 AC 137 ms
88,396 KB
testcase_18 AC 182 ms
98,916 KB
testcase_19 AC 207 ms
99,164 KB
testcase_20 AC 113 ms
81,072 KB
testcase_21 AC 133 ms
85,400 KB
testcase_22 AC 119 ms
82,996 KB
testcase_23 AC 165 ms
94,588 KB
testcase_24 AC 153 ms
92,456 KB
testcase_25 AC 205 ms
99,692 KB
testcase_26 AC 240 ms
98,240 KB
testcase_27 AC 236 ms
98,104 KB
testcase_28 AC 236 ms
98,300 KB
testcase_29 AC 238 ms
98,268 KB
testcase_30 AC 237 ms
98,180 KB
testcase_31 AC 238 ms
98,056 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 j<=N and 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
    if X[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