結果

問題 No.1084 積の積
ユーザー wolgnikwolgnik
提出日時 2020-06-19 22:10:01
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 595 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 93,356 KB
最終ジャッジ日時 2023-09-16 14:30:18
合計ジャッジ時間 5,266 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,352 KB
testcase_01 AC 71 ms
71,356 KB
testcase_02 AC 71 ms
71,060 KB
testcase_03 AC 69 ms
70,992 KB
testcase_04 AC 183 ms
91,624 KB
testcase_05 RE -
testcase_06 AC 176 ms
91,492 KB
testcase_07 RE -
testcase_08 AC 69 ms
71,228 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 80 ms
76,716 KB
testcase_12 AC 92 ms
82,344 KB
testcase_13 AC 105 ms
90,624 KB
testcase_14 AC 90 ms
80,008 KB
testcase_15 AC 88 ms
79,920 KB
testcase_16 AC 105 ms
92,992 KB
testcase_17 AC 88 ms
81,480 KB
testcase_18 AC 99 ms
86,920 KB
testcase_19 AC 105 ms
90,732 KB
testcase_20 AC 86 ms
77,868 KB
testcase_21 AC 88 ms
79,816 KB
testcase_22 AC 85 ms
78,868 KB
testcase_23 AC 94 ms
84,200 KB
testcase_24 AC 94 ms
83,480 KB
testcase_25 AC 106 ms
90,888 KB
testcase_26 AC 114 ms
91,908 KB
testcase_27 AC 109 ms
91,652 KB
testcase_28 AC 114 ms
91,736 KB
testcase_29 AC 114 ms
91,844 KB
testcase_30 AC 113 ms
91,732 KB
testcase_31 AC 114 ms
91,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
rs = [0] * N
r = 0
x = 1
imos = [0] * (N + 1)
imosliner = [0] * (N + 1)
for l in range(N):
  while r < N:
    if x * a[r] >= 10 ** 9:
      rs[l] = r
      break
    x *= a[r]
    r += 1
  else: rs[l] = r
  x //= a[l]
  imos[l] += rs[l] - l
  imosliner[l] -= 1
  imosliner[rs[l]] += 1
#print(imos, imosliner)
for i in range(N):
  imos[i + 1] += imos[i] + imosliner[i]
  imosliner[i + 1] += imosliner[i]
res = 1
for i in range(N):
  res *= pow(a[i], imos[i], mod)
  res %= mod
print(res)
0