結果

問題 No.1237 EXP Multiple!
ユーザー ShirotsumeShirotsume
提出日時 2023-02-17 19:58:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 111,092 KB
最終ジャッジ日時 2023-09-26 17:23:29
合計ジャッジ時間 4,263 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,548 KB
testcase_01 AC 150 ms
100,588 KB
testcase_02 AC 172 ms
110,968 KB
testcase_03 AC 174 ms
111,092 KB
testcase_04 AC 140 ms
110,136 KB
testcase_05 AC 127 ms
105,036 KB
testcase_06 AC 124 ms
104,848 KB
testcase_07 AC 132 ms
105,432 KB
testcase_08 AC 128 ms
105,296 KB
testcase_09 AC 127 ms
105,044 KB
testcase_10 AC 136 ms
105,556 KB
testcase_11 AC 131 ms
104,884 KB
testcase_12 AC 134 ms
105,336 KB
testcase_13 AC 132 ms
105,344 KB
testcase_14 AC 133 ms
105,232 KB
testcase_15 AC 132 ms
105,260 KB
testcase_16 AC 133 ms
105,448 KB
testcase_17 AC 129 ms
105,600 KB
testcase_18 AC 131 ms
105,592 KB
testcase_19 AC 128 ms
105,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())

n = ii()

a = li()
a.sort()
ans = 1
p = [0, 1, 4, 729]
for i in range(n):
    if a[i] >= 4:
        print(10 ** 9 + 7)
        exit()
    else:
        ans *= p[a[i]]
        if ans == 0:
            print(-1)
            exit()
        if ans > 10 ** 9 + 7:
            print(10 ** 9 + 7)
            exit()

if ans == 0:
    print(-1)
else:
    print((10 ** 9 + 7) % ans)
0