結果

問題 No.1237 EXP Multiple!
ユーザー FromBooska
提出日時 2023-02-15 15:22:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,568 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,388 KB
実行使用メモリ 104,112 KB
最終ジャッジ日時 2024-07-18 00:37:42
合計ジャッジ時間 13,124 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
A.sort()
if 0 in A:
    ans = -1
elif max(A) >= 4:
    ans = 10**9+7
else:
    product = 1
    for a in A:
        product *= pow(a, factorial(a))
        if product > 10**9+7:
            print(10**9+7)
            exit()
    ans = (10**9+7)%product
print(ans)
0