結果

問題 No.1522 Unfairness
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-05-15 17:39:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 309 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 32,896 KB
最終ジャッジ日時 2024-04-14 08:03:33
合計ジャッジ時間 7,774 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
17,696 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 TLE -
testcase_04 AC 587 ms
16,256 KB
testcase_05 AC 212 ms
12,672 KB
testcase_06 AC 45 ms
11,136 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

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