結果

問題 No.472 平均順位
ユーザー te-shte-sh
提出日時 2017-12-12 15:20:19
言語 D
(dmd 2.106.1)
結果
MLE  
実行時間 -
コード長 533 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 150,544 KB
実行使用メモリ 304,472 KB
最終ジャッジ日時 2023-09-03 17:30:08
合計ジャッジ時間 9,008 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 9 ms
5,492 KB
testcase_09 AC 34 ms
11,460 KB
testcase_10 AC 23 ms
8,112 KB
testcase_11 AC 104 ms
35,172 KB
testcase_12 AC 73 ms
24,716 KB
testcase_13 AC 277 ms
84,140 KB
testcase_14 MLE -
testcase_15 AC 264 ms
84,060 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 70 ms
22,680 KB
testcase_19 AC 132 ms
43,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), n = rd[0], p = rd[1];
  auto r = new int[][](n, 4);
  foreach (i; 0..n) r[i] = readln.split.to!(int[]) ~ 1;

  auto inf = 10^^9;
  auto dp = new int[][](n+1, p+1);
  foreach (i; 0..n+1) dp[i][] = inf;
  dp[0][0] = 0;

  foreach (i; 0..n)
    foreach (j; 0..p+1)
      foreach (k; 0..4)
        if (j-k >= 0)
          dp[i+1][j] = min(dp[i+1][j], dp[i][j-k] + r[i][k]);

  writefln("%.6f", dp[n][p].to!real / n);
}
0