結果

問題 No.1522 Unfairness
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-05-15 17:39:50
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 383 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 147,976 KB
最終ジャッジ日時 2023-08-12 07:24:18
合計ジャッジ時間 6,781 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,048 KB
testcase_01 AC 74 ms
71,232 KB
testcase_02 AC 74 ms
71,056 KB
testcase_03 AC 163 ms
92,516 KB
testcase_04 AC 101 ms
76,260 KB
testcase_05 AC 94 ms
76,376 KB
testcase_06 AC 85 ms
76,628 KB
testcase_07 AC 210 ms
104,652 KB
testcase_08 AC 184 ms
104,556 KB
testcase_09 AC 90 ms
76,700 KB
testcase_10 AC 127 ms
84,872 KB
testcase_11 AC 100 ms
76,396 KB
testcase_12 AC 142 ms
89,624 KB
testcase_13 AC 249 ms
113,328 KB
testcase_14 AC 100 ms
76,336 KB
testcase_15 AC 383 ms
147,976 KB
testcase_16 AC 374 ms
136,236 KB
testcase_17 AC 364 ms
136,268 KB
testcase_18 AC 375 ms
136,372 KB
testcase_19 AC 377 ms
136,292 KB
testcase_20 AC 280 ms
136,208 KB
testcase_21 AC 74 ms
71,356 KB
testcase_22 AC 73 ms
71,148 KB
testcase_23 AC 74 ms
71,040 KB
testcase_24 AC 96 ms
76,588 KB
testcase_25 AC 78 ms
75,992 KB
testcase_26 AC 92 ms
76,004 KB
testcase_27 AC 71 ms
71,252 KB
testcase_28 AC 79 ms
76,052 KB
testcase_29 AC 93 ms
76,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M=lambda:map(int,input().split())
n,m=M()
a=sorted(list(M()))[::-1]
D,w,v=[[0]*(m+1)for _ in range(n+1)],[a[i]-a[i+1]for i in range(n-1)],[a[i]for i in range(n-1)]
for i in range(n):
 for j in range(m+1):
  if i<n-1 and j+w[i]<=m:D[i+2][j+w[i]]=D[i][j]+v[i]
  D[i+1][j]=max(D[i+1][j],D[i][j])
print(max(D[n]))
0