結果
問題 |
No.472 平均順位
|
ユーザー |
|
提出日時 | 2018-09-23 11:38:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 732 bytes |
コンパイル時間 | 524 ms |
コンパイル使用メモリ | 64,852 KB |
実行使用メモリ | 592,048 KB |
最終ジャッジ日時 | 2024-09-13 19:54:21 |
合計ジャッジ時間 | 11,522 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | MLE * 4 |
other | MLE * 16 |
ソースコード
#include<iostream> #include <iomanip> #include<algorithm> #define MAX_N 5010 #define MAX_P MAX_N*3 #define INF 1e15 long long dp[MAX_N][MAX_P]; int main(){ std::cout<<std::fixed<<std::setprecision(6); int N, P, a, b, c; std::cin>>N>>P; for(int i = 0; i < MAX_N; i++)for(int j = 0; j < MAX_P; j++)dp[i][j]=INF; dp[0][0] = 0; for(int i = 0; i < N; i++){ std::cin>>a>>b>>c; for(int j = 0; j <= N*3; j++){ if(dp[i][j] == INF) continue; dp[i+1][j] = std::min(dp[i][j]+a,dp[i+1][j] ); dp[i+1][j+1] = std::min(dp[i][j]+b,dp[i+1][j+1]); dp[i+1][j+2] = std::min(dp[i][j]+c,dp[i+1][j+2]); dp[i+1][j+3] = std::min(dp[i][j]+1,dp[i+1][j+3]); } } std::cout<<(double)dp[N][P]/N<<std::endl; return 0; }