結果

問題 No.1237 EXP Multiple!
ユーザー shotoyooshotoyoo
提出日時 2020-09-25 22:21:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 104,500 KB
最終ジャッジ日時 2023-09-10 17:26:28
合計ジャッジ時間 3,593 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,400 KB
testcase_01 AC 106 ms
97,920 KB
testcase_02 AC 120 ms
99,936 KB
testcase_03 AC 119 ms
100,064 KB
testcase_04 AC 121 ms
99,532 KB
testcase_05 AC 106 ms
103,716 KB
testcase_06 AC 105 ms
103,584 KB
testcase_07 AC 106 ms
103,580 KB
testcase_08 AC 111 ms
104,500 KB
testcase_09 AC 105 ms
103,684 KB
testcase_10 AC 106 ms
103,740 KB
testcase_11 AC 106 ms
103,740 KB
testcase_12 AC 109 ms
104,128 KB
testcase_13 AC 107 ms
104,028 KB
testcase_14 AC 107 ms
104,032 KB
testcase_15 AC 106 ms
104,348 KB
testcase_16 AC 106 ms
104,128 KB
testcase_17 AC 107 ms
104,028 KB
testcase_18 AC 106 ms
104,048 KB
testcase_19 AC 106 ms
103,576 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()))
M = 10**9+7
if 0 in a:
    ans = -1
else:
    v = 1
    for k in a:
        if k==1:
            pass
        elif k>=4:
            ans = M
            break
        else:
            d = [1,1,2,6]
            v *= pow(k, d[k])
            if v>M:
                ans = M
                break
    else:
        ans = M%v
print(ans)
0