結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,712 KB
testcase_01 AC 72 ms
23,700 KB
testcase_02 AC 86 ms
29,188 KB
testcase_03 AC 84 ms
30,232 KB
testcase_04 AC 89 ms
29,852 KB
testcase_05 AC 49 ms
11,976 KB
testcase_06 AC 66 ms
12,036 KB
testcase_07 AC 49 ms
12,076 KB
testcase_08 AC 105 ms
12,076 KB
testcase_09 AC 48 ms
12,028 KB
testcase_10 AC 48 ms
12,024 KB
testcase_11 AC 67 ms
12,032 KB
testcase_12 AC 67 ms
11,904 KB
testcase_13 WA -
testcase_14 AC 110 ms
12,052 KB
testcase_15 AC 109 ms
11,956 KB
testcase_16 AC 110 ms
11,976 KB
testcase_17 AC 109 ms
12,088 KB
testcase_18 AC 113 ms
11,924 KB
testcase_19 AC 59 ms
11,936 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)
if all(va == 1 for va in a):
    print(-1)
    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