結果

問題 No.505 カードの数式2
ユーザー 👑 rin204rin204
提出日時 2022-04-16 20:11:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 1,308 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 71,468 KB
最終ジャッジ日時 2023-08-26 20:43:20
合計ジャッジ時間 5,193 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,200 KB
testcase_01 AC 65 ms
70,904 KB
testcase_02 AC 63 ms
71,416 KB
testcase_03 AC 61 ms
71,384 KB
testcase_04 AC 65 ms
71,216 KB
testcase_05 AC 63 ms
71,276 KB
testcase_06 AC 63 ms
71,216 KB
testcase_07 AC 67 ms
71,072 KB
testcase_08 AC 65 ms
71,168 KB
testcase_09 AC 65 ms
71,168 KB
testcase_10 AC 65 ms
71,416 KB
testcase_11 WA -
testcase_12 AC 63 ms
71,092 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 62 ms
71,388 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 67 ms
71,200 KB
testcase_20 AC 67 ms
71,320 KB
testcase_21 AC 66 ms
71,172 KB
testcase_22 AC 64 ms
71,408 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 62 ms
70,904 KB
testcase_27 AC 63 ms
71,220 KB
testcase_28 AC 62 ms
71,192 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
min_ = A[0]
max_ = A[0]

for a in A[1:]:
    lst = []
    for x in [min_, max_]:
        lst.append(x * a)
        lst.append(x + a)
        lst.append(x - a)
        if a != 0:
            pm = (x >= 0) ^ (a >= 0)
            tmp = abs(x) // abs(a)
            lst.append(tmp * pm)
    min_ = min(lst)
    max_ = max(lst)
print(max_)
    
0