結果
問題 | No.1084 積の積 |
ユーザー | yuji9511 |
提出日時 | 2020-06-19 22:39:41 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,013 bytes |
コンパイル時間 | 260 ms |
コンパイル使用メモリ | 87,012 KB |
実行使用メモリ | 843,796 KB |
最終ジャッジ日時 | 2023-09-16 14:54:10 |
合計ジャッジ時間 | 4,145 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
74,276 KB |
testcase_01 | AC | 76 ms
74,384 KB |
testcase_02 | AC | 75 ms
74,568 KB |
testcase_03 | AC | 79 ms
76,228 KB |
testcase_04 | AC | 238 ms
92,244 KB |
testcase_05 | RE | - |
testcase_06 | AC | 226 ms
92,196 KB |
testcase_07 | AC | 75 ms
74,388 KB |
testcase_08 | AC | 76 ms
74,432 KB |
testcase_09 | MLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
ソースコード
N = int(input()) A = list(map(int, input().split())) left_mul = [0] * 100010 right_mul = [0] * 100010 left_mul[0] = 1 for i in range(N): left_mul[i+1] = left_mul[i] * A[i] right_mul[0] = 1 for i in range(N): right_mul[i+1] = right_mul[i] * A[N-1-i] mul_all = left_mul[N] ans = 1 MOD = 1000000007 arr = [0] * 100010 val = [0] * 100010 for i in range(N): lv = i rv = N while rv - lv > 1: mid = (rv + lv) // 2 mul_v = mul_all // left_mul[i] // right_mul[N-1-mid] if mul_v >= 1000000000: rv = mid else: lv = mid length = lv - i + 1 val[i] += length arr[lv+2] += 1 # for j in range(i,lv+1): # ans *= pow(A[j], length,MOD) # ans %= MOD # length -= 1 for i in range(N+1): arr[i+1] += arr[i] n = 0 cur = 0 # print(val[:10]) # print(arr[:10]) for i in range(N): cur += val[i] cur -= n; cur += arr[i] # print(cur) ans *= pow(A[i], cur, MOD) ans %= MOD n += 1 print(ans)