結果
問題 | No.472 平均順位 |
ユーザー |
|
提出日時 | 2022-03-25 14:23:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 289 ms / 2,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 2,283 ms |
コンパイル使用メモリ | 196,016 KB |
最終ジャッジ日時 | 2025-01-28 11:20:16 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int n, p; cin >> n >> p;int inf = 1e9;vector dp(p + 1, inf); dp[0] = 0;for(int k = 0; k < n; ++k){vector d(4, 1), ndp(p + 1, inf); swap(dp, ndp);for(int i = 0; i < 3; ++i) cin >> d[i];for(int i = 0; i <= 3; ++i){for(int j = 0; j <= p - i; ++j){dp[j + i] = min(dp[j + i], ndp[j] + d[i]);}}}printf("%.6f\n", dp[p] / double(n));}