結果

問題 No.1237 EXP Multiple!
ユーザー oevloevl
提出日時 2020-10-26 00:48:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 30,024 KB
最終ジャッジ日時 2023-09-29 02:24:24
合計ジャッジ時間 2,814 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,912 KB
testcase_01 AC 67 ms
23,768 KB
testcase_02 AC 88 ms
29,128 KB
testcase_03 AC 86 ms
30,024 KB
testcase_04 AC 90 ms
29,836 KB
testcase_05 AC 49 ms
12,012 KB
testcase_06 AC 67 ms
12,056 KB
testcase_07 AC 50 ms
11,988 KB
testcase_08 AC 108 ms
11,968 KB
testcase_09 AC 49 ms
12,056 KB
testcase_10 AC 49 ms
12,084 KB
testcase_11 AC 67 ms
12,056 KB
testcase_12 AC 65 ms
12,020 KB
testcase_13 AC 105 ms
12,016 KB
testcase_14 AC 102 ms
12,076 KB
testcase_15 AC 102 ms
12,072 KB
testcase_16 AC 99 ms
12,056 KB
testcase_17 AC 100 ms
12,020 KB
testcase_18 AC 101 ms
12,020 KB
testcase_19 AC 57 ms
11,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

if any(va == 0 for va in a):
    print(-1)
    exit(0)
if any(va > 3 for va in a):
    print(mod)
    exit(0)

f = [1]
for i in range(3):
    f.append(f[-1] * (i + 1))
for i in range(len(f)):
    f[i] = pow(i, f[i])

ans = 1

for va in a:
    if ans > mod:
        print(mod)
        exit(0)
    else:
        ans *= f[va]

print(mod % ans)
0