結果

問題 No.1237 EXP Multiple!
ユーザー c-yanc-yan
提出日時 2020-09-27 00:03:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 29,888 KB
最終ジャッジ日時 2023-09-12 12:55:38
合計ジャッジ時間 3,987 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,872 KB
testcase_01 AC 93 ms
23,744 KB
testcase_02 AC 126 ms
29,216 KB
testcase_03 AC 128 ms
29,800 KB
testcase_04 AC 81 ms
29,888 KB
testcase_05 AC 51 ms
11,668 KB
testcase_06 AC 51 ms
11,736 KB
testcase_07 AC 56 ms
11,664 KB
testcase_08 AC 106 ms
11,664 KB
testcase_09 AC 51 ms
11,756 KB
testcase_10 AC 55 ms
11,688 KB
testcase_11 AC 51 ms
11,664 KB
testcase_12 AC 51 ms
11,592 KB
testcase_13 AC 106 ms
11,656 KB
testcase_14 AC 102 ms
11,772 KB
testcase_15 AC 103 ms
11,668 KB
testcase_16 AC 113 ms
11,672 KB
testcase_17 AC 102 ms
11,732 KB
testcase_18 AC 103 ms
11,748 KB
testcase_19 AC 51 ms
11,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


N, *A = map(int, open(0).read().split())

A.sort()

if A[0] == 0:
    print(-1)
    exit()

if A[-1] >= 4:
    print(m)
    exit()

fac = make_factorial_table(3)

t = 1
for a in A:
    t *= pow(a, fac[a])
    if t > m:
        break
print(m % t)
0