結果

問題 No.472 平均順位
ユーザー pinpin
提出日時 2017-11-16 19:50:15
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 857 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 73,700 KB
実行使用メモリ 590,072 KB
最終ジャッジ日時 2023-08-16 17:03:11
合計ジャッジ時間 6,675 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 4 ms
15,908 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 3 ms
7,716 KB
testcase_07 AC 5 ms
18,056 KB
testcase_08 AC 17 ms
52,980 KB
testcase_09 AC 51 ms
120,540 KB
testcase_10 AC 45 ms
147,220 KB
testcase_11 AC 120 ms
184,296 KB
testcase_12 AC 101 ms
177,928 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 83 ms
145,412 KB
testcase_19 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
const ll INF = 10000000000000;

ll dp[5005][15005];
ll n, p, a[5005][4];

int main(void){
    cin >> n >> p;
    for (int i = 0; i < n; i++){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
        a[i][3] = 1;
    }

    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= p; 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 < 4; k++){
                if (k <= j) dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - k]+a[i][k]);
            }
        }
    }

    double ans = (double)dp[n][p] / n;
    cout << ans << endl;

}
0