結果

問題 No.472 平均順位
ユーザー H3PO4H3PO4
提出日時 2020-08-23 10:21:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 914 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 43,740 KB
最終ジャッジ日時 2024-04-23 17:30:00
合計ジャッジ時間 12,804 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 444 ms
43,612 KB
testcase_01 AC 446 ms
43,716 KB
testcase_02 AC 451 ms
43,720 KB
testcase_03 AC 447 ms
43,608 KB
testcase_04 AC 449 ms
43,736 KB
testcase_05 AC 448 ms
43,736 KB
testcase_06 AC 456 ms
43,740 KB
testcase_07 AC 449 ms
43,608 KB
testcase_08 AC 458 ms
43,732 KB
testcase_09 AC 476 ms
43,352 KB
testcase_10 AC 471 ms
43,616 KB
testcase_11 AC 513 ms
43,592 KB
testcase_12 AC 497 ms
43,608 KB
testcase_13 AC 617 ms
43,480 KB
testcase_14 AC 833 ms
43,608 KB
testcase_15 AC 608 ms
43,604 KB
testcase_16 AC 887 ms
43,484 KB
testcase_17 AC 914 ms
43,728 KB
testcase_18 AC 483 ms
43,740 KB
testcase_19 AC 558 ms
43,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, P = map(int, input().split())
dp = np.zeros(P + 1, dtype=int)

for _ in range(N):
    a, b, c = map(int, input().split())
    new_dp = dp + a
    new_dp[1:] = np.minimum(new_dp[1:], dp[:-1] + b)
    new_dp[2:] = np.minimum(new_dp[2:], dp[:-2] + c)
    new_dp[3:] = np.minimum(new_dp[3:], dp[:-3] + 1)
    dp = new_dp

print(dp[P] / N)
0