結果
問題 | No.472 平均順位 |
ユーザー |
|
提出日時 | 2017-11-27 15:31:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 357 ms / 2,000 ms |
コード長 | 654 bytes |
コンパイル時間 | 670 ms |
コンパイル使用メモリ | 67,288 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 11:01:13 |
合計ジャッジ時間 | 2,767 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <iostream> #include <algorithm> #include <stdio.h> using namespace std; typedef long double ld; const int INF = 1 << 29; int N, P; int dp1[15010], dp2[15010]; int main(void) { cin >> N >> P; for (int p = 0; p <= P; ++p) dp1[p] = dp2[p] = INF; dp1[0] = 0; for (int n = 0; n < N; ++n) { int nums[4]; cin >> nums[0] >> nums[1] >> nums[2]; nums[3] = 1; for (int p = 0; p <= P; ++p) { if (dp1[p] == INF) continue; for (int i = 0; i < 4; ++i) { dp2[p + i] = min(dp2[p + i], dp1[p] + nums[i]); } } for (int i = 0; i <= P; ++i) { dp1[i] = dp2[i]; dp2[i] = INF; } } printf("%.15Lf\n", (ld)dp1[P] / (ld)N); return 0; }