結果

問題 No.1237 EXP Multiple!
ユーザー komkompikomkompi
提出日時 2020-10-23 20:23:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,760 KB
実行使用メモリ 30,092 KB
最終ジャッジ日時 2023-09-28 15:40:30
合計ジャッジ時間 2,642 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 67 ms
23,820 KB
testcase_02 AC 81 ms
29,188 KB
testcase_03 AC 79 ms
30,092 KB
testcase_04 AC 85 ms
29,844 KB
testcase_05 AC 50 ms
12,104 KB
testcase_06 AC 52 ms
12,168 KB
testcase_07 AC 51 ms
12,096 KB
testcase_08 AC 86 ms
12,136 KB
testcase_09 AC 50 ms
12,172 KB
testcase_10 AC 50 ms
12,176 KB
testcase_11 AC 52 ms
12,236 KB
testcase_12 AC 82 ms
12,140 KB
testcase_13 AC 87 ms
12,100 KB
testcase_14 AC 87 ms
12,168 KB
testcase_15 AC 87 ms
12,096 KB
testcase_16 AC 90 ms
12,100 KB
testcase_17 AC 89 ms
12,104 KB
testcase_18 AC 90 ms
12,180 KB
testcase_19 AC 52 ms
12,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))

if 0 in A:
    print(-1)
    exit()

ans=1
mod=(10**9+7)
for a in A:
    if a>=4:
        ans*=(mod+1)
    elif a==3:
        ans*=3**6
    elif a==2:
        ans*=2**2
    elif a==0:
        ans*=0
    
    if ans>mod:
        print(mod)
        exit()

if ans==0:
    print(-1)
else:
    print(mod%ans)
0