結果

問題 No.1237 EXP Multiple!
ユーザー 👑 tamatotamato
提出日時 2020-09-25 21:30:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 656 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 87,524 KB
実行使用メモリ 104,412 KB
最終ジャッジ日時 2023-09-10 17:21:24
合計ジャッジ時間 3,866 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,844 KB
testcase_01 AC 100 ms
96,876 KB
testcase_02 AC 118 ms
99,612 KB
testcase_03 AC 118 ms
99,552 KB
testcase_04 AC 119 ms
99,480 KB
testcase_05 AC 101 ms
103,632 KB
testcase_06 AC 101 ms
103,524 KB
testcase_07 AC 100 ms
103,664 KB
testcase_08 AC 104 ms
104,016 KB
testcase_09 AC 102 ms
103,632 KB
testcase_10 AC 101 ms
103,672 KB
testcase_11 AC 103 ms
103,728 KB
testcase_12 AC 104 ms
104,004 KB
testcase_13 AC 103 ms
104,280 KB
testcase_14 AC 105 ms
104,304 KB
testcase_15 AC 103 ms
104,404 KB
testcase_16 AC 105 ms
104,384 KB
testcase_17 AC 102 ms
104,004 KB
testcase_18 AC 104 ms
104,412 KB
testcase_19 AC 104 ms
103,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(-1)
    else:
        f = 1
        B = []
        for i in range(1, 10**5):
            f *= i
            new = i ** f
            if new > mod:
                break
            B.append(new)
        ans = 1
        for a in A:
            if a > len(B):
                print(mod)
                exit()
            ans *= B[a-1]
            if ans > mod:
                print(mod)
                exit()
        print(mod % ans)


if __name__ == '__main__':
    main()
0