結果

問題 No.1237 EXP Multiple!
ユーザー NagisaNagisa
提出日時 2020-09-25 23:16:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 30,120 KB
最終ジャッジ日時 2023-09-10 16:17:02
合計ジャッジ時間 4,473 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
16,028 KB
testcase_01 AC 136 ms
23,708 KB
testcase_02 AC 155 ms
29,040 KB
testcase_03 AC 149 ms
30,120 KB
testcase_04 AC 153 ms
29,912 KB
testcase_05 AC 50 ms
12,088 KB
testcase_06 AC 122 ms
17,784 KB
testcase_07 AC 51 ms
11,988 KB
testcase_08 AC 191 ms
17,776 KB
testcase_09 AC 49 ms
12,044 KB
testcase_10 AC 49 ms
11,976 KB
testcase_11 AC 122 ms
17,628 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 189 ms
17,804 KB
testcase_15 AC 188 ms
17,900 KB
testcase_16 AC 190 ms
17,628 KB
testcase_17 AC 194 ms
17,780 KB
testcase_18 AC 190 ms
17,776 KB
testcase_19 AC 52 ms
12,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(-1)
    exit(0)

fac = [1 for k in range(200010)]
for k in range(2,200010):
    fac[k] = (fac[k-1]*k)%MOD

ans = 1
for e in A:
    if e > 10:
        print(MOD)
        exit(0)
    ans *= pow(e,fac[e],MOD)
    if ans > MOD:
        print(MOD)
        exit(0)
if ans == 1:
    print(-1)
else:
    print(MOD%ans)
0