結果

問題 No.2232 Miser's Gift
ユーザー U SU S
提出日時 2023-03-04 00:13:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 1,137 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 155,612 KB
最終ジャッジ日時 2023-10-18 03:54:05
合計ジャッジ時間 11,525 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
61,124 KB
testcase_01 AC 51 ms
61,124 KB
testcase_02 AC 51 ms
61,124 KB
testcase_03 AC 189 ms
155,612 KB
testcase_04 AC 244 ms
155,348 KB
testcase_05 AC 81 ms
76,812 KB
testcase_06 AC 50 ms
61,124 KB
testcase_07 AC 77 ms
77,724 KB
testcase_08 AC 210 ms
155,348 KB
testcase_09 AC 212 ms
155,348 KB
testcase_10 AC 208 ms
155,348 KB
testcase_11 AC 208 ms
155,348 KB
testcase_12 AC 211 ms
155,348 KB
testcase_13 AC 187 ms
155,612 KB
testcase_14 AC 192 ms
155,612 KB
testcase_15 AC 192 ms
155,612 KB
testcase_16 AC 190 ms
155,612 KB
testcase_17 AC 190 ms
155,348 KB
testcase_18 AC 189 ms
155,476 KB
testcase_19 AC 187 ms
155,612 KB
testcase_20 AC 187 ms
155,612 KB
testcase_21 AC 188 ms
155,612 KB
testcase_22 AC 187 ms
155,348 KB
testcase_23 AC 228 ms
155,348 KB
testcase_24 AC 231 ms
155,348 KB
testcase_25 AC 233 ms
155,348 KB
testcase_26 AC 232 ms
155,348 KB
testcase_27 AC 225 ms
155,348 KB
testcase_28 AC 219 ms
155,348 KB
testcase_29 AC 218 ms
155,348 KB
testcase_30 AC 220 ms
155,348 KB
testcase_31 AC 220 ms
155,348 KB
testcase_32 AC 221 ms
155,348 KB
testcase_33 AC 193 ms
155,612 KB
testcase_34 AC 193 ms
155,612 KB
testcase_35 AC 194 ms
155,612 KB
testcase_36 AC 193 ms
155,348 KB
testcase_37 AC 190 ms
155,612 KB
testcase_38 AC 64 ms
68,328 KB
testcase_39 AC 64 ms
68,328 KB
testcase_40 AC 64 ms
68,328 KB
testcase_41 AC 64 ms
68,328 KB
testcase_42 AC 65 ms
68,328 KB
testcase_43 AC 64 ms
68,328 KB
testcase_44 AC 65 ms
68,328 KB
testcase_45 AC 65 ms
68,328 KB
testcase_46 AC 65 ms
68,328 KB
testcase_47 AC 65 ms
68,328 KB
testcase_48 AC 60 ms
66,152 KB
testcase_49 AC 59 ms
66,152 KB
testcase_50 AC 61 ms
66,144 KB
testcase_51 AC 59 ms
66,144 KB
testcase_52 AC 59 ms
66,144 KB
testcase_53 AC 59 ms
66,152 KB
testcase_54 AC 59 ms
66,152 KB
testcase_55 AC 59 ms
66,152 KB
testcase_56 AC 58 ms
66,152 KB
testcase_57 AC 59 ms
66,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys
# input = sys.stdin.readline
# sys.setrecursionlimit(10**7)
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
def lm1(LIST): return list(map(lambda x:x-1, LIST))
def mps(A):return [tuple(map(int, input().split())) for _ in range(A)]
def stoi(LIST):return list(map(int,LIST))
def itos(LIST):return list(map(str,LIST))
def atoi(LIST): return [ord(i)-ord("a") for i in LIST]
def Atoi(LIST): return [ord(i)-ord("A") for i in LIST]
def bitA(X,A):return X & 1<<A == 1<<A
import math
import bisect
import heapq
import time
from copy import copy as cc
from copy import deepcopy as dc
from itertools import accumulate, product
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = (1<<63)-1
mod = int(1e9+7)

n,w = mp()
prev = [0]*(w+1)
for i in range(n):
    now = cc(prev)
    W,V = mp()
    for j in range(w+1):
        if j + W <= w:
            now[j+W] = max(now[j+W], prev[j]+V)
    prev = now
for i in range(w-1,-1,-1):
    print(prev[-1]-prev[i]+1)
0