結果

問題 No.1237 EXP Multiple!
ユーザー shotoyoo
提出日時 2020-09-25 22:21:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 105,728 KB
最終ジャッジ日時 2024-06-28 08:35:11
合計ジャッジ時間 2,736 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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