結果
| 問題 |
No.1084 積の積
|
| コンテスト | |
| ユーザー |
nehan_der_thal
|
| 提出日時 | 2020-06-19 22:58:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 681 bytes |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 82,152 KB |
| 実行使用メモリ | 109,392 KB |
| 最終ジャッジ日時 | 2024-07-03 15:27:12 |
| 合計ジャッジ時間 | 5,591 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 26 WA * 1 |
ソースコード
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)
nehan_der_thal