結果

問題 No.2232 Miser's Gift
ユーザー ch1channnch1channn
提出日時 2023-03-12 02:48:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 558 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 156,800 KB
最終ジャッジ日時 2023-10-18 10:27:02
合計ジャッジ時間 18,427 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,508 KB
testcase_01 AC 39 ms
53,508 KB
testcase_02 AC 38 ms
53,508 KB
testcase_03 AC 364 ms
156,252 KB
testcase_04 AC 317 ms
156,132 KB
testcase_05 AC 95 ms
83,912 KB
testcase_06 AC 38 ms
53,512 KB
testcase_07 AC 70 ms
78,760 KB
testcase_08 AC 366 ms
156,668 KB
testcase_09 AC 370 ms
156,644 KB
testcase_10 AC 365 ms
156,672 KB
testcase_11 AC 445 ms
156,632 KB
testcase_12 AC 369 ms
156,668 KB
testcase_13 AC 336 ms
156,672 KB
testcase_14 AC 334 ms
156,688 KB
testcase_15 AC 336 ms
156,680 KB
testcase_16 AC 333 ms
156,680 KB
testcase_17 AC 336 ms
156,676 KB
testcase_18 AC 334 ms
156,680 KB
testcase_19 AC 332 ms
156,684 KB
testcase_20 AC 333 ms
156,688 KB
testcase_21 AC 334 ms
156,684 KB
testcase_22 AC 333 ms
156,676 KB
testcase_23 AC 558 ms
156,728 KB
testcase_24 AC 558 ms
156,736 KB
testcase_25 AC 494 ms
156,732 KB
testcase_26 AC 483 ms
156,552 KB
testcase_27 AC 549 ms
156,748 KB
testcase_28 AC 357 ms
156,704 KB
testcase_29 AC 355 ms
156,692 KB
testcase_30 AC 355 ms
156,684 KB
testcase_31 AC 413 ms
156,704 KB
testcase_32 AC 410 ms
156,724 KB
testcase_33 AC 336 ms
156,308 KB
testcase_34 AC 339 ms
156,740 KB
testcase_35 AC 338 ms
156,752 KB
testcase_36 AC 335 ms
156,800 KB
testcase_37 AC 338 ms
156,676 KB
testcase_38 AC 61 ms
66,160 KB
testcase_39 AC 61 ms
66,160 KB
testcase_40 AC 61 ms
66,160 KB
testcase_41 AC 61 ms
66,160 KB
testcase_42 AC 63 ms
68,220 KB
testcase_43 AC 63 ms
66,160 KB
testcase_44 AC 64 ms
68,232 KB
testcase_45 AC 62 ms
68,220 KB
testcase_46 AC 62 ms
68,220 KB
testcase_47 AC 59 ms
66,148 KB
testcase_48 AC 51 ms
63,904 KB
testcase_49 AC 50 ms
61,832 KB
testcase_50 AC 52 ms
63,912 KB
testcase_51 AC 51 ms
63,904 KB
testcase_52 AC 52 ms
63,904 KB
testcase_53 AC 52 ms
63,904 KB
testcase_54 AC 52 ms
63,904 KB
testcase_55 AC 53 ms
63,920 KB
testcase_56 AC 53 ms
63,904 KB
testcase_57 AC 53 ms
63,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
if sys.platform =='ios':
	import clipboard
	a=clipboard.get()
	a = a.split('\n')
	text = '\n'.join(a)
	with open('input_file.txt','w') as f:
		f.write(text)
	sys.stdin = open('input_file.txt')
sys.setrecursionlimit(410000000)
stdin = sys.stdin 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
nm = lambda: map(int,input().split())
na_1 = lambda: list(map(lambda x:int(x)*(-1), stdin.readline().split()))
na_2 = lambda: list(map(lambda x:int(x)-1, stdin.readline().split()))

N,W = nm()
dp = [[0]*(W+1) for i in range(N+1)]

wv = [na()for i in range(N)]

for i in range(1,N+1):
	for j in range(W+1):
		dp[i][j] = max(dp[i][j],dp[i-1][j])
		if j >= wv[i-1][0]:
			dp[i][j] = max(dp[i][j],dp[i-1][j-wv[i-1][0]]+wv[i-1][1])

for x in range(1,W+1):
	print(dp[N][W]-dp[N][W-x]+1)
				
0