結果

問題 No.1237 EXP Multiple!
ユーザー tanon710tanon710
提出日時 2020-09-25 23:44:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 379 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 30,160 KB
最終ジャッジ日時 2023-09-10 17:13:29
合計ジャッジ時間 2,738 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 69 ms
23,700 KB
testcase_02 AC 91 ms
29,092 KB
testcase_03 AC 87 ms
30,160 KB
testcase_04 AC 92 ms
29,900 KB
testcase_05 AC 49 ms
12,032 KB
testcase_06 WA -
testcase_07 AC 51 ms
12,032 KB
testcase_08 WA -
testcase_09 AC 52 ms
12,044 KB
testcase_10 AC 50 ms
12,096 KB
testcase_11 WA -
testcase_12 AC 57 ms
12,156 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 51 ms
12,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
arr=list(map(int,input().split()))
if arr.count(0)!=0:
    print(-1)
elif arr.count(1)+arr.count(2)+arr.count(3)!=n:
    print(10**9+7)
else:
    mod=10**9+7
    ans=1
    for val in arr:
        if val==1:
            ans*=1
        elif val==2:
            ans*=4
            ans%=mod
        elif val==3:
            ans*=729
            ans%=mod
    print(ans)
0