結果

問題 No.472 平均順位
ユーザー SugarDragon5SugarDragon5
提出日時 2017-09-20 16:47:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 945 bytes
コンパイル時間 1,670 ms
コンパイル使用メモリ 169,624 KB
実行使用メモリ 296,960 KB
最終ジャッジ日時 2024-04-25 21:13:40
合計ジャッジ時間 4,755 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 6 ms
6,944 KB
testcase_09 AC 20 ms
11,392 KB
testcase_10 AC 14 ms
8,704 KB
testcase_11 AC 59 ms
28,544 KB
testcase_12 AC 42 ms
21,120 KB
testcase_13 AC 150 ms
69,120 KB
testcase_14 AC 540 ms
244,352 KB
testcase_15 AC 146 ms
68,992 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 41 ms
20,736 KB
testcase_19 AC 75 ms
34,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int n,p;
    cin>>n>>p;
    vvi d(n,vi(4,1));
    REP(i,n){
        REP(j,3){
            cin>>d[i][j];
        }
    }
    vvi dp(n+1,vi(p+1,INF));

    dp[0][0]=0;
    REP(i,n){
        REP(j,p+1){
            REP(k,4){
                if(j+k<=p){
                    dp[i+1][j+k]=min(dp[i][j]+d[i][k],dp[i+1][j+k]);
                }
            }
        }
    }
    double ans=(double)dp[n][p]/(double)n;
    cout<<fixed<<setprecision(10)<<ans<<endl;
    return 0;
}
0