結果

問題 No.1237 EXP Multiple!
ユーザー keijakkeijak
提出日時 2020-09-25 22:20:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 30,436 KB
最終ジャッジ日時 2023-09-10 17:26:24
合計ジャッジ時間 2,777 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,788 KB
testcase_01 AC 69 ms
23,616 KB
testcase_02 AC 88 ms
29,308 KB
testcase_03 AC 91 ms
30,136 KB
testcase_04 AC 88 ms
30,436 KB
testcase_05 AC 60 ms
11,548 KB
testcase_06 AC 61 ms
11,508 KB
testcase_07 AC 62 ms
11,468 KB
testcase_08 AC 94 ms
11,468 KB
testcase_09 AC 60 ms
11,356 KB
testcase_10 AC 60 ms
11,508 KB
testcase_11 AC 62 ms
11,348 KB
testcase_12 AC 87 ms
11,344 KB
testcase_13 AC 93 ms
11,356 KB
testcase_14 AC 91 ms
11,344 KB
testcase_15 AC 91 ms
11,364 KB
testcase_16 AC 91 ms
11,368 KB
testcase_17 AC 91 ms
11,360 KB
testcase_18 AC 91 ms
11,544 KB
testcase_19 AC 60 ms
11,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
A = inl()
M = 10 ** 9 + 7


def solve():
    if any([x == 0 for x in A]):
        return -1

    ans = 1
    for x in A:
        for k in range(2, x + 1):
            x = x ** k
            if x > M:
                return M
        ans *= x
        if ans > M:
            return M
    return M % ans


print(solve())
0