結果

問題 No.1583 Building Blocks
ユーザー googol_S0googol_S0
提出日時 2021-07-02 21:39:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 85,224 KB
最終ジャッジ日時 2023-10-12 03:02:14
合計ジャッジ時間 6,461 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,416 KB
testcase_01 AC 75 ms
71,456 KB
testcase_02 AC 77 ms
71,364 KB
testcase_03 AC 99 ms
76,388 KB
testcase_04 AC 87 ms
76,104 KB
testcase_05 AC 85 ms
76,140 KB
testcase_06 AC 98 ms
76,308 KB
testcase_07 AC 101 ms
76,612 KB
testcase_08 AC 87 ms
75,864 KB
testcase_09 AC 125 ms
83,808 KB
testcase_10 AC 81 ms
75,944 KB
testcase_11 AC 79 ms
71,156 KB
testcase_12 AC 107 ms
76,792 KB
testcase_13 AC 117 ms
81,788 KB
testcase_14 AC 98 ms
76,528 KB
testcase_15 AC 105 ms
76,444 KB
testcase_16 AC 117 ms
81,432 KB
testcase_17 AC 108 ms
76,672 KB
testcase_18 AC 92 ms
75,936 KB
testcase_19 AC 131 ms
85,224 KB
testcase_20 AC 97 ms
76,472 KB
testcase_21 AC 97 ms
76,592 KB
testcase_22 AC 98 ms
76,392 KB
testcase_23 AC 89 ms
76,028 KB
testcase_24 AC 107 ms
76,504 KB
testcase_25 AC 78 ms
71,528 KB
testcase_26 AC 119 ms
82,528 KB
testcase_27 AC 95 ms
76,540 KB
testcase_28 AC 125 ms
83,348 KB
testcase_29 AC 92 ms
76,416 KB
testcase_30 AC 86 ms
75,996 KB
testcase_31 AC 110 ms
76,340 KB
testcase_32 AC 99 ms
76,416 KB
testcase_33 AC 129 ms
85,024 KB
testcase_34 AC 77 ms
71,456 KB
testcase_35 AC 100 ms
76,232 KB
testcase_36 AC 118 ms
82,076 KB
testcase_37 AC 93 ms
75,924 KB
testcase_38 AC 78 ms
71,344 KB
testcase_39 AC 78 ms
71,556 KB
testcase_40 AC 78 ms
71,304 KB
testcase_41 AC 78 ms
71,480 KB
testcase_42 AC 78 ms
71,320 KB
testcase_43 AC 80 ms
71,160 KB
testcase_44 AC 78 ms
71,456 KB
testcase_45 AC 77 ms
71,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
X=[list(map(int,input().split())) for i in range(N)]
INF=10**15
DP=[[INF]*(N+1) for i in range(N+1)]
X.sort(key=lambda x:sum(x))
DP[0][0]=0
for i in range(N):
  for j in range(i+1):
    if DP[i][j]<=X[i][1]:
      DP[i+1][j+1]=min(DP[i+1][j+1],DP[i][j]+X[i][0])
    DP[i+1][j]=min(DP[i+1][j],DP[i][j])
for i in range(N,-1,-1):
  if DP[N][i]<INF:
    print(i)
    exit()
0