結果
| 問題 | 
                            No.1237 EXP Multiple!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-11-15 22:51:24 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 118 ms / 2,000 ms | 
| コード長 | 420 bytes | 
| コンパイル時間 | 326 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 102,224 KB | 
| 最終ジャッジ日時 | 2024-09-26 04:54:19 | 
| 合計ジャッジ時間 | 3,862 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 19 | 
ソースコード
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
tmp = 1
X = [0,1,4,729]
if 0 in A:
    print(-1)
    exit()
for a in A:
    if a>=4:
        print(mod)
        exit()
    else:
        tmp *= X[a]
        if tmp > mod:
            print(mod)
            exit()
print(mod%tmp)