結果
問題 | No.472 平均順位 |
ユーザー |
![]() |
提出日時 | 2019-04-09 15:25:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,178 ms / 2,000 ms |
コード長 | 653 bytes |
コンパイル時間 | 456 ms |
コンパイル使用メモリ | 61,560 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 23:01:44 |
合計ジャッジ時間 | 5,452 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include<cstdio> #include<algorithm> #include<iostream> #include<cmath> using namespace std; const int INF=1e9; int dp[2][20010]; int N,P; int score[5010][5]; int main(void){ cin>>N>>P; for(int i=0;i<N;i++){ cin>>score[i][0]>>score[i][1]>>score[i][2]; score[i][3]=1; } for(int i=0;i<2;i++){ for(int j=0;j<20010;j++){ dp[i][j]=INF; } } dp[0][0]=0; for(int i=0;i<N;i++){ for(int j=0;j<=P;j++){ for(int k=0;k<=3;k++){ if(j+k<=P){ dp[1][j+k]=min(dp[0][j]+score[i][k],dp[1][j+k]); } } } for(int j=0;j<=P;j++){ dp[0][j]=dp[1][j]; dp[1][j]=INF; } } printf("%.9lf\n",(double)dp[0][P]/(double)N); return 0; }