結果

問題 No.472 平均順位
ユーザー pluto77pluto77
提出日時 2018-01-05 13:36:23
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,341 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 77,744 KB
実行使用メモリ 80,952 KB
最終ジャッジ日時 2023-08-24 20:17:02
合計ジャッジ時間 7,846 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,488 KB
testcase_01 AC 74 ms
76,432 KB
testcase_02 AC 72 ms
76,328 KB
testcase_03 AC 74 ms
76,404 KB
testcase_04 AC 91 ms
78,928 KB
testcase_05 AC 74 ms
76,516 KB
testcase_06 AC 83 ms
79,096 KB
testcase_07 AC 104 ms
79,132 KB
testcase_08 AC 135 ms
80,828 KB
testcase_09 AC 169 ms
80,384 KB
testcase_10 AC 158 ms
80,828 KB
testcase_11 AC 248 ms
80,692 KB
testcase_12 AC 212 ms
80,852 KB
testcase_13 AC 415 ms
80,480 KB
testcase_14 AC 1,171 ms
80,952 KB
testcase_15 AC 435 ms
80,544 KB
testcase_16 AC 1,341 ms
80,504 KB
testcase_17 AC 1,020 ms
80,548 KB
testcase_18 AC 200 ms
80,416 KB
testcase_19 AC 270 ms
80,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_472

INF=float('inf')
n,p=map(int,raw_input().split())
dp = [INF for i in xrange(p+4)]
for i in xrange(n):
 a,b,c=map(int,raw_input().split())
 if i == 0:
  dp[0]=a
  dp[1]=b
  dp[2]=c
  dp[3]=1 
  continue
 for j in xrange(p,-1,-1):
  dp[j]=dp[j]+a
  if j>0: dp[j]=min(dp[j],dp[j-1]+b)
  if j>1: dp[j]=min(dp[j],dp[j-2]+c)
  if j>2: dp[j]=min(dp[j],dp[j-3]+1)

print 1.0*dp[p]/n
0