結果
問題 | No.472 平均順位 |
ユーザー |
|
提出日時 | 2017-12-12 15:21:45 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 859 ms / 2,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 2,402 ms |
コンパイル使用メモリ | 151,404 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 23:02:00 |
合計ジャッジ時間 | 6,225 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
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[](p+1), dp2 = new int[](p+1);dp[] = inf;dp[0] = 0;foreach (i; 0..n) {dp2[] = inf;foreach (j; 0..p+1)foreach (k; 0..4)if (j-k >= 0)dp2[j] = min(dp2[j], dp[j-k] + r[i][k]);dp[] = dp2[];}writefln("%.6f", dp[p].to!real / n);}