結果

問題 No.505 カードの数式2
ユーザー 👑 rin204rin204
提出日時 2022-04-16 20:12:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 86,756 KB
実行使用メモリ 71,344 KB
最終ジャッジ日時 2023-08-26 20:43:43
合計ジャッジ時間 4,268 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,264 KB
testcase_01 AC 72 ms
71,300 KB
testcase_02 AC 72 ms
71,300 KB
testcase_03 AC 74 ms
71,324 KB
testcase_04 AC 72 ms
70,892 KB
testcase_05 AC 74 ms
71,124 KB
testcase_06 AC 72 ms
71,020 KB
testcase_07 AC 73 ms
71,052 KB
testcase_08 AC 73 ms
71,128 KB
testcase_09 AC 73 ms
71,344 KB
testcase_10 AC 72 ms
71,148 KB
testcase_11 AC 73 ms
71,120 KB
testcase_12 AC 72 ms
71,124 KB
testcase_13 AC 69 ms
71,316 KB
testcase_14 AC 70 ms
71,020 KB
testcase_15 AC 73 ms
71,232 KB
testcase_16 AC 72 ms
71,300 KB
testcase_17 AC 71 ms
71,324 KB
testcase_18 AC 73 ms
71,148 KB
testcase_19 AC 74 ms
70,988 KB
testcase_20 AC 73 ms
71,328 KB
testcase_21 AC 73 ms
71,228 KB
testcase_22 AC 73 ms
71,024 KB
testcase_23 AC 72 ms
71,080 KB
testcase_24 AC 73 ms
71,340 KB
testcase_25 AC 74 ms
71,292 KB
testcase_26 AC 73 ms
71,220 KB
testcase_27 AC 72 ms
71,060 KB
testcase_28 AC 72 ms
71,016 KB
testcase_29 AC 72 ms
71,344 KB
testcase_30 AC 74 ms
71,164 KB
testcase_31 AC 73 ms
71,016 KB
権限があれば一括ダウンロードができます

ソースコード

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)
            if pm:
                tmp *= -1
            lst.append(tmp)
    min_ = min(lst)
    max_ = max(lst)
print(max_)
    
0