結果
問題 | No.472 平均順位 |
ユーザー |
![]() |
提出日時 | 2018-06-01 23:02:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 255 ms / 2,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 534 ms |
コンパイル使用メモリ | 67,284 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 08:58:32 |
合計ジャッジ時間 | 2,567 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; #define INF 500000001 int n,p; int dp[15005]; int main(void){ scanf("%d%d",&n,&p); for(int i=0;i<=p;i++)dp[i]=INF; dp[0]=0; for(int i=0;i<n;i++){ int a,b,c; scanf("%d%d%d",&a,&b,&c); for(int j=p;j>=0;j--){ dp[j]+=a; if(j-1>=0)dp[j]=min(dp[j],dp[j-1]+b); if(j-2>=0)dp[j]=min(dp[j],dp[j-2]+c); if(j-3>=0)dp[j]=min(dp[j],dp[j-3]+1); } } printf("%lf\n",double(dp[p])/double(n)); }