結果

問題 No.1237 EXP Multiple!
ユーザー shotoyooshotoyoo
提出日時 2020-09-25 21:58:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 104,876 KB
最終ジャッジ日時 2023-09-10 15:25:39
合計ジャッジ時間 3,808 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 109 ms
103,668 KB
testcase_06 WA -
testcase_07 AC 105 ms
103,752 KB
testcase_08 WA -
testcase_09 AC 105 ms
103,700 KB
testcase_10 AC 102 ms
103,696 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 107 ms
103,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
ans = 1
d = [None]*200
M = 10**9+7
def sub(k):
    if k>=200:
        return 1
    else:
        if d[k] is not None:
            return d[k]
        else:
            v = 1
            for num in range(1, k+1):
                v *= num
                v %= (M-1)
            val = pow(k, v, M)
            d[k] = val
            return val
if 0 in a:
    print(-1)
else:
    for k in a:
        ans *= sub(k)
        ans %= M
    print(ans%M)
0