結果

問題 No.1237 EXP Multiple!
ユーザー tanon710tanon710
提出日時 2020-09-25 23:46:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 86,440 KB
実行使用メモリ 104,308 KB
最終ジャッジ日時 2023-09-10 17:31:21
合計ジャッジ時間 3,605 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
70,732 KB
testcase_01 AC 104 ms
97,600 KB
testcase_02 AC 122 ms
99,760 KB
testcase_03 AC 124 ms
99,852 KB
testcase_04 AC 124 ms
99,180 KB
testcase_05 AC 102 ms
103,340 KB
testcase_06 AC 102 ms
103,348 KB
testcase_07 AC 105 ms
103,744 KB
testcase_08 AC 110 ms
103,960 KB
testcase_09 AC 107 ms
103,324 KB
testcase_10 AC 106 ms
103,456 KB
testcase_11 AC 108 ms
103,636 KB
testcase_12 AC 107 ms
103,360 KB
testcase_13 AC 108 ms
103,920 KB
testcase_14 AC 106 ms
103,924 KB
testcase_15 AC 106 ms
104,164 KB
testcase_16 AC 112 ms
103,864 KB
testcase_17 AC 112 ms
104,032 KB
testcase_18 AC 113 ms
104,308 KB
testcase_19 AC 110 ms
103,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7

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(mod)
else:
    ans=1
    for val in arr:
        if val==1:
            ans*=1
        elif val==2:
            ans*=4
        elif val==3:
            ans*=729
        if ans>mod:
            print(mod)
            break
    else:
        print(mod%ans)
0