結果
| 問題 | 
                            No.1237 EXP Multiple!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-09-26 11:08:46 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 327 bytes | 
| コンパイル時間 | 159 ms | 
| コンパイル使用メモリ | 82,780 KB | 
| 実行使用メモリ | 107,456 KB | 
| 最終ジャッジ日時 | 2024-06-28 21:09:11 | 
| 合計ジャッジ時間 | 2,416 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 18 WA * 1 | 
ソースコード
n=int(input())
a=list(map(int,input().split()))
#ギャグ
mod=10**9+7
if max(a)>3:
    print(mod)
    exit()
if min(a)==0:
    print(-1)
    exit()
ans=1
for i in a:
    sub=1
    for j in range(i):
        sub*=(j+1)
    ans*=(i**sub)
    if ans>10**9+7:
        print(mod)
        exit()
print(mod%ans if mod%ans!=0 else -1)