結果

問題 No.505 カードの数式2
ユーザー titiatitia
提出日時 2023-07-17 02:42:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 283 bytes
コンパイル時間 1,006 ms
コンパイル使用メモリ 11,912 KB
実行使用メモリ 123,492 KB
最終ジャッジ日時 2023-10-18 00:16:08
合計ジャッジ時間 8,473 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,208 KB
testcase_01 AC 28 ms
10,248 KB
testcase_02 AC 45 ms
14,164 KB
testcase_03 AC 28 ms
10,204 KB
testcase_04 AC 29 ms
10,204 KB
testcase_05 AC 29 ms
10,204 KB
testcase_06 AC 28 ms
10,204 KB
testcase_07 AC 29 ms
10,204 KB
testcase_08 AC 29 ms
10,204 KB
testcase_09 AC 30 ms
10,204 KB
testcase_10 AC 29 ms
10,204 KB
testcase_11 AC 30 ms
10,204 KB
testcase_12 AC 29 ms
10,204 KB
testcase_13 AC 29 ms
10,204 KB
testcase_14 AC 28 ms
10,204 KB
testcase_15 AC 28 ms
10,204 KB
testcase_16 AC 29 ms
10,204 KB
testcase_17 AC 29 ms
10,204 KB
testcase_18 AC 29 ms
10,204 KB
testcase_19 AC 29 ms
10,212 KB
testcase_20 AC 29 ms
10,204 KB
testcase_21 AC 29 ms
10,204 KB
testcase_22 AC 450 ms
66,060 KB
testcase_23 AC 115 ms
22,892 KB
testcase_24 AC 29 ms
10,252 KB
testcase_25 AC 30 ms
10,256 KB
testcase_26 AC 874 ms
123,216 KB
testcase_27 AC 634 ms
104,484 KB
testcase_28 TLE -
testcase_29 AC 126 ms
10,208 KB
testcase_30 AC 29 ms
10,208 KB
testcase_31 AC 999 ms
123,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

NOW={A[0]}

for i in range(1,N):
    NNOW=set()
    a=A[i]

    for n in NOW:
        NNOW.add(n+a)
        NNOW.add(n-a)
        NNOW.add(n*a)

        if n<0 and a>0:
            NNOW.add(-(abs(n)//a))

    NOW=NNOW

print(max(NOW))
0