結果
問題 |
No.472 平均順位
|
ユーザー |
![]() |
提出日時 | 2020-05-09 22:26:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,025 bytes |
コンパイル時間 | 1,625 ms |
コンパイル使用メモリ | 173,756 KB |
実行使用メモリ | 296,960 KB |
最終ジャッジ日時 | 2024-07-06 05:09:13 |
合計ジャッジ時間 | 4,108 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 MLE * 2 |
ソースコード
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < n; i++) #define ALL(a) a.begin(), a.end() #define MOD 1000000007 using namespace std; typedef long long ll; int main() { int N, P; cin >> N >> P; vector<int> A(N), B(N), C(N); REP(i, 0, N) cin >> A[i] >> B[i] >> C[i]; vector<vector<int>> dp(N + 1, vector<int>(P + 1, 1 << 30)); dp[0][0] = 0; REP(i, 0, N) { REP(j, 0, P + 1) { dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + A[i]); if (j + 1 <= P) dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + B[i]); if (j + 2 <= P) dp[i + 1][j + 2] = min(dp[i + 1][j + 2], dp[i][j] + C[i]); if (j + 3 <= P) dp[i + 1][j + 3] = min(dp[i + 1][j + 3], dp[i][j] + 1); } } // REP(i, 0, N + 1) { // REP(j, 0, P + 1) { // cout << setw(12) << setfill(' ') << dp[i][j]; // } // cout << endl; // } cout << fixed << setprecision(15); cout << (double)dp[N][P] / N << endl; return 0; }