結果

問題 No.1237 EXP Multiple!
ユーザー cmycmy
提出日時 2022-08-18 03:32:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 105,472 KB
最終ジャッジ日時 2024-04-15 14:14:27
合計ジャッジ時間 3,188 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,584 KB
testcase_01 AC 82 ms
99,072 KB
testcase_02 AC 106 ms
103,180 KB
testcase_03 AC 107 ms
103,460 KB
testcase_04 AC 113 ms
103,604 KB
testcase_05 AC 84 ms
103,680 KB
testcase_06 AC 84 ms
104,064 KB
testcase_07 AC 84 ms
103,552 KB
testcase_08 AC 88 ms
105,288 KB
testcase_09 AC 85 ms
104,248 KB
testcase_10 AC 85 ms
103,552 KB
testcase_11 AC 85 ms
103,808 KB
testcase_12 AC 87 ms
103,936 KB
testcase_13 AC 87 ms
104,832 KB
testcase_14 AC 85 ms
105,472 KB
testcase_15 AC 86 ms
104,704 KB
testcase_16 AC 87 ms
104,704 KB
testcase_17 AC 88 ms
105,088 KB
testcase_18 AC 87 ms
104,960 KB
testcase_19 AC 83 ms
103,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MX = 10**9+7

n = int(input())
*a, = map(int, input().split())
if min(a) == 0:
    print(-1)
elif max(a) > 3:
    print(MX)
else:
    v = [1, 4, 729]
    ans = 1
    for ai in a:
        ans *= v[ai-1]
        if ans > MX:
            print(MX)
            break
    else:
        print(MX % ans)
0