結果

問題 No.505 カードの数式2
ユーザー ntuda
提出日時 2024-12-18 19:37:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 340 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 54,116 KB
最終ジャッジ日時 2024-12-18 19:37:59
合計ジャッジ時間 2,623 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

Q = [A[0]]
for a in A[1:]:
    Q2 = []
    while Q:
        x = Q.pop()
        Q2.append(x * a)
        Q2.append(x + a)
        Q2.append(x - a)
        if a > 0:
            Q2.append(x//a)
        elif a < 0:
            Q2.append(-(-x)//a)
    Q = [min(Q2),max(Q2)]

print(max(Q))
0