結果

問題 No.1583 Building Blocks
ユーザー wolgnikwolgnik
提出日時 2021-07-02 22:42:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 796 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 76,636 KB
最終ジャッジ日時 2023-09-11 23:05:18
合計ジャッジ時間 6,097 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 75 ms
70,988 KB
testcase_02 AC 73 ms
71,020 KB
testcase_03 AC 86 ms
76,180 KB
testcase_04 AC 80 ms
75,520 KB
testcase_05 AC 79 ms
75,444 KB
testcase_06 AC 85 ms
76,388 KB
testcase_07 AC 86 ms
76,444 KB
testcase_08 AC 80 ms
75,612 KB
testcase_09 AC 90 ms
76,252 KB
testcase_10 AC 79 ms
75,560 KB
testcase_11 AC 75 ms
71,100 KB
testcase_12 AC 88 ms
76,264 KB
testcase_13 WA -
testcase_14 AC 87 ms
76,284 KB
testcase_15 AC 86 ms
76,176 KB
testcase_16 AC 89 ms
76,000 KB
testcase_17 WA -
testcase_18 AC 85 ms
75,832 KB
testcase_19 AC 92 ms
76,176 KB
testcase_20 AC 85 ms
76,060 KB
testcase_21 AC 86 ms
76,040 KB
testcase_22 AC 87 ms
76,188 KB
testcase_23 AC 81 ms
75,832 KB
testcase_24 AC 89 ms
76,028 KB
testcase_25 AC 73 ms
71,164 KB
testcase_26 AC 91 ms
76,224 KB
testcase_27 AC 86 ms
76,092 KB
testcase_28 AC 92 ms
76,324 KB
testcase_29 AC 85 ms
75,940 KB
testcase_30 AC 82 ms
75,492 KB
testcase_31 AC 89 ms
76,220 KB
testcase_32 AC 86 ms
76,344 KB
testcase_33 AC 90 ms
76,340 KB
testcase_34 AC 74 ms
71,044 KB
testcase_35 AC 86 ms
76,160 KB
testcase_36 AC 89 ms
76,416 KB
testcase_37 AC 82 ms
75,876 KB
testcase_38 AC 76 ms
71,164 KB
testcase_39 AC 76 ms
71,220 KB
testcase_40 WA -
testcase_41 AC 75 ms
70,856 KB
testcase_42 AC 75 ms
71,388 KB
testcase_43 AC 75 ms
71,052 KB
testcase_44 AC 76 ms
71,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = [tuple(map(int, input().split())) for _ in range(N)]
a.sort(key = lambda x: (x[1], x[0]))
inf = 10 ** 9 * N
dp = [inf] * (N + 1)
dp[0] = 0
for i in range(N):
  w, s = a[i]
  for i in range(N - 1, -1, -1):
    if dp[i] <= s: dp[i + 1] = min(dp[i + 1], dp[i] + w)
for i in range(N, -1, -1):
  if dp[i] < inf:
    print(i)
    break
0