結果
| 問題 | No.505 カードの数式2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-28 12:14:44 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 503 bytes |
| 記録 | |
| コンパイル時間 | 74 ms |
| コンパイル使用メモリ | 81,132 KB |
| 実行使用メモリ | 83,328 KB |
| 最終ジャッジ日時 | 2026-09-15 09:01:45 |
| 合計ジャッジ時間 | 24,030 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 4 |
ソースコード
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
from itertools import permutations,product,combinations_with_replacement,groupby,accumulate,combinations
N = int(input())
A = list(map(int,input().split()))
ans = 0
for L in product((0,1,2),repeat = N - 1):
ret = A[0]
for i in range(N - 1):
if L[i] == 0:
ret += A[i + 1]
elif L[i] == 1:
ret -= A[i + 1]
else:
ret *= A[i + 1]
ans = max(ans,ret)
print(ans)