結果

問題 No.505 カードの数式2
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-13 22:31:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 71,500 KB
最終ジャッジ日時 2023-08-20 23:39:54
合計ジャッジ時間 4,396 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,308 KB
testcase_01 AC 70 ms
71,244 KB
testcase_02 AC 70 ms
71,236 KB
testcase_03 AC 71 ms
71,360 KB
testcase_04 AC 72 ms
71,400 KB
testcase_05 AC 71 ms
71,448 KB
testcase_06 AC 70 ms
70,988 KB
testcase_07 AC 71 ms
71,220 KB
testcase_08 AC 70 ms
71,392 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 69 ms
71,496 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 70 ms
71,140 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 69 ms
71,440 KB
testcase_20 AC 70 ms
71,244 KB
testcase_21 AC 70 ms
71,288 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 70 ms
71,364 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))

dp=[[0,0] for i in range(n+1)]

for i in range(n):
    t=[]
    t.append(dp[i][0] - a[i])
    t.append(dp[i][1] - a[i])
    t.append(dp[i][0] + a[i])
    t.append(dp[i][1] + a[i])
    t.append(dp[i][0] * a[i])
    t.append(dp[i][1] * a[i])
    if a[i] !=0:
        t.append(dp[i][0] // a[i])
        t.append(dp[i][1] // a[i])
    t.sort()
    dp[i+1][0]=t[0]
    dp[i+1][1]=t[-1]

print(dp[-1][1])
0