結果
| 問題 |
No.1237 EXP Multiple!
|
| コンテスト | |
| ユーザー |
wolgnik
|
| 提出日時 | 2020-09-25 22:26:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 2,000 ms |
| コード長 | 345 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 82,560 KB |
| 実行使用メモリ | 105,216 KB |
| 最終ジャッジ日時 | 2024-06-28 08:35:32 |
| 合計ジャッジ時間 | 2,835 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort()
mod = 10 ** 9 + 7
q = 1
for x in a:
if x == 1: continue
if x == 0:
q = 0
break
t = x
for i in range(1, x + 1):
t = pow(t, i)
if q * t > mod:
print(mod)
exit(0)
q *= t
if q > 0: print(mod % q)
else: print(-1)
wolgnik