結果

問題 No.1522 Unfairness
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-05-15 17:39:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 137,088 KB
最終ジャッジ日時 2024-04-29 21:53:07
合計ジャッジ時間 5,053 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,968 KB
testcase_01 AC 37 ms
51,584 KB
testcase_02 AC 39 ms
51,840 KB
testcase_03 AC 136 ms
92,940 KB
testcase_04 AC 73 ms
69,632 KB
testcase_05 AC 65 ms
67,584 KB
testcase_06 AC 54 ms
64,384 KB
testcase_07 AC 175 ms
91,836 KB
testcase_08 AC 148 ms
91,264 KB
testcase_09 AC 59 ms
65,792 KB
testcase_10 AC 90 ms
74,624 KB
testcase_11 AC 68 ms
68,992 KB
testcase_12 AC 113 ms
88,320 KB
testcase_13 AC 226 ms
114,688 KB
testcase_14 AC 73 ms
69,120 KB
testcase_15 AC 352 ms
136,960 KB
testcase_16 AC 352 ms
136,960 KB
testcase_17 AC 344 ms
136,960 KB
testcase_18 AC 354 ms
137,088 KB
testcase_19 AC 354 ms
136,960 KB
testcase_20 AC 251 ms
137,088 KB
testcase_21 AC 40 ms
52,096 KB
testcase_22 AC 40 ms
52,096 KB
testcase_23 AC 41 ms
52,480 KB
testcase_24 AC 65 ms
67,712 KB
testcase_25 AC 47 ms
59,136 KB
testcase_26 AC 58 ms
65,152 KB
testcase_27 AC 40 ms
51,840 KB
testcase_28 AC 47 ms
59,136 KB
testcase_29 AC 62 ms
65,920 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