結果

問題 No.798 コレクション
ユーザー stngstng
提出日時 2022-07-02 13:17:40
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 372 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 95,300 KB
最終ジャッジ日時 2023-08-18 04:10:57
合計ジャッジ時間 19,188 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 OLE -
testcase_14 OLE -
testcase_15 OLE -
testcase_16 WA -
testcase_17 OLE -
testcase_18 OLE -
testcase_19 OLE -
testcase_20 OLE -
testcase_21 WA -
testcase_22 OLE -
testcase_23 WA -
testcase_24 OLE -
testcase_25 OLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ab = [[int(i) for i in input().split()] for j in range(n)]

ab.sort(reverse=True, key=lambda x: x[1])
INF = 10**9

dp = [[INF]*(n+1) for i in range(n+1)]

dp[0][0] = 0

for i in range(1,n+1):
    for j in range(n+1):
        dp[i][j] = min(dp[i-1][j-1],dp[i-1][j]+ab[i-1][0]+ab[i-1][1]*(i-j-1))
        print(i,j,ab[i-1][0],ab[i-1][1])

print(dp[n][n//3])
0